aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-02-18 14:20:56 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-02-18 14:20:56 -0300
commitd2ebdc045bae7c8ed0e62729ca455444c076b1bb (patch)
tree3237f58be972a4e328380e6ec1f96bbf1b8b70d4 /lapi.c
parent81ede6bfcedb9304974110e00a2a4ba301afb4f7 (diff)
downloadlua-d2ebdc045bae7c8ed0e62729ca455444c076b1bb.tar.gz
lua-d2ebdc045bae7c8ed0e62729ca455444c076b1bb.tar.bz2
lua-d2ebdc045bae7c8ed0e62729ca455444c076b1bb.zip
new macro 'lua_checkversion' to check whether core and application are
compatible
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lapi.c b/lapi.c
index 9af75b17..86b591c4 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.67 2008/07/04 18:27:11 roberto Exp roberto $ 2** $Id: lapi.c,v 2.68 2008/08/01 17:01:16 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*/
@@ -121,6 +121,16 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
121} 121}
122 122
123 123
124LUA_API void lua_checkversion_ (lua_State *L, int version) {
125 lua_lock(L);
126 if (version != LUA_VERSION_NUM)
127 luaG_runerror(L, "application and Lua core using different Lua versions");
128 if (G(L)->nilobjp != luaO_nilobject)
129 luaG_runerror(L, "application using two incompatible Lua VMs");
130 lua_unlock(L);
131}
132
133
124 134
125/* 135/*
126** basic stack manipulation 136** basic stack manipulation