diff options
-rw-r--r-- | lapi.c | 14 | ||||
-rw-r--r-- | lstate.c | 4 | ||||
-rw-r--r-- | lstate.h | 4 | ||||
-rw-r--r-- | lua.h | 5 |
4 files changed, 12 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.81 2009/06/17 18:38:54 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.82 2009/06/18 16:36:40 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -129,13 +129,11 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { | |||
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | LUA_API void lua_checkversion_ (lua_State *L, int version) { | 132 | static const lua_Number l_version = LUA_VERSION_NUM; |
133 | lua_lock(L); | 133 | |
134 | if (version != LUA_VERSION_NUM) | 134 | LUA_API const lua_Number *lua_version (lua_State *L) { |
135 | luaG_runerror(L, "app./library not compiled with header " LUA_VERSION); | 135 | if (L == NULL) return &l_version; |
136 | if (G(L)->nilobjp != luaO_nilobject) | 136 | else return G(L)->version; |
137 | luaG_runerror(L, "application using multiple Lua VMs"); | ||
138 | lua_unlock(L); | ||
139 | } | 137 | } |
140 | 138 | ||
141 | 139 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.54 2009/04/28 19:04:36 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.55 2009/06/01 19:09:26 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -208,7 +208,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
208 | setnilvalue(registry(L)); | 208 | setnilvalue(registry(L)); |
209 | luaZ_initbuffer(L, &g->buff); | 209 | luaZ_initbuffer(L, &g->buff); |
210 | g->panic = NULL; | 210 | g->panic = NULL; |
211 | g->nilobjp = luaO_nilobject; | 211 | g->version = lua_version(NULL); |
212 | g->gcstate = GCSpause; | 212 | g->gcstate = GCSpause; |
213 | g->rootgc = obj2gco(L); | 213 | g->rootgc = obj2gco(L); |
214 | g->sweepstrgc = 0; | 214 | g->sweepstrgc = 0; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.43 2009/04/17 22:00:01 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.44 2009/06/01 19:09:26 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -148,9 +148,9 @@ typedef struct global_State { | |||
148 | TValue l_registry; | 148 | TValue l_registry; |
149 | struct lua_State *mainthread; | 149 | struct lua_State *mainthread; |
150 | UpVal uvhead; /* head of double-linked list of all open upvalues */ | 150 | UpVal uvhead; /* head of double-linked list of all open upvalues */ |
151 | const lua_Number *version; /* pointer to version number */ | ||
151 | struct Table *mt[NUM_TAGS]; /* metatables for basic types */ | 152 | struct Table *mt[NUM_TAGS]; /* metatables for basic types */ |
152 | TString *tmname[TM_N]; /* array with tag-method names */ | 153 | TString *tmname[TM_N]; /* array with tag-method names */ |
153 | const TValue *nilobjp; /* pointer to nil object (to check consistency) */ | ||
154 | } global_State; | 154 | } global_State; |
155 | 155 | ||
156 | 156 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.238 2009/06/15 19:51:31 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.239 2009/06/17 17:49:44 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
@@ -118,8 +118,7 @@ LUA_API lua_State *(lua_mainthread) (lua_State *L); | |||
118 | LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); | 118 | LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); |
119 | 119 | ||
120 | 120 | ||
121 | LUA_API void lua_checkversion_ (lua_State *L, int version); | 121 | LUA_API const lua_Number *lua_version (lua_State *L); |
122 | #define lua_checkversion(L) (lua_checkversion_(L, LUA_VERSION_NUM)) | ||
123 | 122 | ||
124 | 123 | ||
125 | /* | 124 | /* |