new function 'lua_version' (so that 'checkversion' can be implemented

in the auxiliary library)
This commit is contained in:
Roberto Ierusalimschy
2009-06-18 15:59:18 -03:00
parent bc3e02a1b7
commit 1d6ebce296
4 changed files with 12 additions and 15 deletions

14
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.81 2009/06/17 18:38:54 roberto Exp roberto $
** $Id: lapi.c,v 2.82 2009/06/18 16:36:40 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -129,13 +129,11 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
}
LUA_API void lua_checkversion_ (lua_State *L, int version) {
lua_lock(L);
if (version != LUA_VERSION_NUM)
luaG_runerror(L, "app./library not compiled with header " LUA_VERSION);
if (G(L)->nilobjp != luaO_nilobject)
luaG_runerror(L, "application using multiple Lua VMs");
lua_unlock(L);
static const lua_Number l_version = LUA_VERSION_NUM;
LUA_API const lua_Number *lua_version (lua_State *L) {
if (L == NULL) return &l_version;
else return G(L)->version;
}