diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-06-18 15:59:18 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-06-18 15:59:18 -0300 |
| commit | 1d6ebce2969d3bfe406633fd8e284ff187ce00f2 (patch) | |
| tree | 5c961b9e2de11fb58fe44d9c2d80be25d756bf0c /lapi.c | |
| parent | bc3e02a1b7d65c908409549160f567fad14cd238 (diff) | |
| download | lua-1d6ebce2969d3bfe406633fd8e284ff187ce00f2.tar.gz lua-1d6ebce2969d3bfe406633fd8e284ff187ce00f2.tar.bz2 lua-1d6ebce2969d3bfe406633fd8e284ff187ce00f2.zip | |
new function 'lua_version' (so that 'checkversion' can be implemented
in the auxiliary library)
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 14 |
1 files changed, 6 insertions, 8 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 | ||
