aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-12-22 14:47:00 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-12-22 14:47:00 -0200
commitcb3f95d51696005e69d24b2bbc22f2fc3116b424 (patch)
tree27440471aa248ee487fa6d850cf57ea82d8721af
parentf84b575cfa52dc832751846aa0b4c8ff437d3ca3 (diff)
downloadlua-cb3f95d51696005e69d24b2bbc22f2fc3116b424.tar.gz
lua-cb3f95d51696005e69d24b2bbc22f2fc3116b424.tar.bz2
lua-cb3f95d51696005e69d24b2bbc22f2fc3116b424.zip
'lua_cpcall' is deprecated
-rw-r--r--lapi.c5
-rw-r--r--lua.h5
-rw-r--r--luaconf.h10
3 files changed, 14 insertions, 6 deletions
diff --git a/lapi.c b/lapi.c
index 2dee45a5..0d29807a 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.105 2009/12/17 16:20:01 roberto Exp roberto $ 2** $Id: lapi.c,v 2.106 2009/12/22 15:32:50 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*/
@@ -1148,10 +1148,11 @@ LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,
1148} 1148}
1149 1149
1150 1150
1151#if defined(LUA_COMPAT_CPCALL)
1151LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { 1152LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) {
1152 lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_CPCALL); 1153 lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_CPCALL);
1153 lua_pushlightuserdata(L, &func); 1154 lua_pushlightuserdata(L, &func);
1154 lua_pushlightuserdata(L, ud); 1155 lua_pushlightuserdata(L, ud);
1155 return lua_pcall(L, 2, 0, 0); 1156 return lua_pcall(L, 2, 0, 0);
1156} 1157}
1157 1158#endif
diff --git a/lua.h b/lua.h
index 63bcf922..d3fffb11 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.255 2009/12/18 15:32:36 roberto Exp roberto $ 2** $Id: lua.h,v 1.256 2009/12/22 15:32:50 roberto Exp roberto $
3** Lua - A Scripting Language 3** Lua - A Scripting 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
@@ -239,7 +239,6 @@ LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
239 int ctx, lua_CFunction k); 239 int ctx, lua_CFunction k);
240#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) 240#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
241 241
242LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
243LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, 242LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
244 const char *chunkname); 243 const char *chunkname);
245 244
@@ -299,7 +298,7 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
299#define lua_newtable(L) lua_createtable(L, 0, 0) 298#define lua_newtable(L) lua_createtable(L, 0, 0)
300 299
301#define lua_register(L,n,f) \ 300#define lua_register(L,n,f) \
302 (lua_pushcfunction(L, (f)), lua_setfield(L, LUA_GLOBALSINDEX, (n))) 301 (lua_pushcfunction(L, (f)), lua_setfield(L, LUA_ENVIRONINDEX, (n)))
303 302
304#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) 303#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
305 304
diff --git a/luaconf.h b/luaconf.h
index 6efab22a..0768c9f4 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.123 2009/12/17 12:50:20 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.124 2009/12/17 13:08:51 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -206,6 +206,14 @@
206*/ 206*/
207 207
208/* 208/*
209@@ LUA_COMPAT_CPCALL controls the presence of function 'lua_cpcall'.
210** CHANGE it (define it) if you need this function. (You can replace
211** it with the preregistered function cpcall.)
212*/
213/* #define LUA_COMPAT_CPCALL */
214/* LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); */
215
216/*
209@@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'. 217@@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'.
210** CHANGE it (define it) if you need these functions. (You can replace 218** CHANGE it (define it) if you need these functions. (You can replace
211** them with lexical environments, 'loadin', or the debug library.) 219** them with lexical environments, 'loadin', or the debug library.)