mirror of
https://github.com/lua/lua.git
synced 2025-01-14 05:43:00 +08:00
keep 'luaL_checkversion_' with its signature in version 5.2, for
correct error messages in case of version mixings
This commit is contained in:
parent
2f02d264e9
commit
4422b97472
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.c,v 1.260 2014/03/12 20:57:40 roberto Exp roberto $
|
||||
** $Id: lauxlib.c,v 1.261 2014/04/01 18:55:06 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -966,12 +966,12 @@ LUALIB_API lua_State *luaL_newstate (void) {
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkversion_ (lua_State *L, int ver, size_t sz) {
|
||||
LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) {
|
||||
const lua_Number *v = lua_version(L);
|
||||
if (v != lua_version(NULL))
|
||||
luaL_error(L, "multiple Lua VMs detected");
|
||||
else if (*v != ver)
|
||||
luaL_error(L, "version mismatch: app. needs %d, Lua core provides %f",
|
||||
luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
|
||||
ver, *v);
|
||||
/* check numeric types */
|
||||
if (sz != LUAL_NUMSIZES)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.h,v 1.122 2013/06/27 18:32:33 roberto Exp roberto $
|
||||
** $Id: lauxlib.h,v 1.123 2014/01/05 14:04:46 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -28,7 +28,7 @@ typedef struct luaL_Reg {
|
||||
|
||||
#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number))
|
||||
|
||||
LUALIB_API void (luaL_checkversion_) (lua_State *L, int ver, size_t sz);
|
||||
LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz);
|
||||
#define luaL_checkversion(L) \
|
||||
luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user