diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-08 10:58:04 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-08 10:58:04 -0200 |
commit | 81646af13b5dc0c36388616b9ea6087952d9b57e (patch) | |
tree | b71d3ab33c3134e4625a8fb2c27213c6b774ad9b /lbaselib.c | |
parent | 233b71c092b742ef4b133cd2eb0adbe4f73d4ece (diff) | |
download | lua-81646af13b5dc0c36388616b9ea6087952d9b57e.tar.gz lua-81646af13b5dc0c36388616b9ea6087952d9b57e.tar.bz2 lua-81646af13b5dc0c36388616b9ea6087952d9b57e.zip |
'loadstring' deprecated; use 'load' instead
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.252 2010/12/06 16:25:48 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.253 2010/12/07 11:40:42 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -114,12 +114,10 @@ static int luaB_setmetatable (lua_State *L) { | |||
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | static int luaB_getfenv (lua_State *L) { | 117 | static int luaB_deprecated (lua_State *L) { |
118 | return luaL_error(L, "getfenv/setfenv deprecated"); | 118 | return luaL_error(L, "deprecated function"); |
119 | } | 119 | } |
120 | 120 | ||
121 | #define luaB_setfenv luaB_getfenv | ||
122 | |||
123 | 121 | ||
124 | static int luaB_rawequal (lua_State *L) { | 122 | static int luaB_rawequal (lua_State *L) { |
125 | luaL_checkany(L, 1); | 123 | luaL_checkany(L, 1); |
@@ -348,12 +346,13 @@ static int luaB_loadin (lua_State *L) { | |||
348 | } | 346 | } |
349 | 347 | ||
350 | 348 | ||
351 | static int luaB_loadstring (lua_State *L) { | 349 | #if defined(LUA_COMPAT_LOADSTRING) |
352 | lua_settop(L, 2); | 350 | #define luaB_loadstring luaB_load |
353 | lua_pushliteral(L, "tb"); | 351 | #else |
354 | return luaB_load(L); /* loadstring(s, n) == load(s, n, "tb") */ | 352 | #define luaB_loadstring luaB_deprecated |
353 | #endif | ||
354 | |||
355 | 355 | ||
356 | } | ||
357 | /* }====================================================== */ | 356 | /* }====================================================== */ |
358 | 357 | ||
359 | 358 | ||
@@ -473,7 +472,7 @@ static const luaL_Reg base_funcs[] = { | |||
473 | {"collectgarbage", luaB_collectgarbage}, | 472 | {"collectgarbage", luaB_collectgarbage}, |
474 | {"dofile", luaB_dofile}, | 473 | {"dofile", luaB_dofile}, |
475 | {"error", luaB_error}, | 474 | {"error", luaB_error}, |
476 | {"getfenv", luaB_getfenv}, | 475 | {"getfenv", luaB_deprecated}, |
477 | {"getmetatable", luaB_getmetatable}, | 476 | {"getmetatable", luaB_getmetatable}, |
478 | {"ipairs", luaB_ipairs}, | 477 | {"ipairs", luaB_ipairs}, |
479 | {"loadfile", luaB_loadfile}, | 478 | {"loadfile", luaB_loadfile}, |
@@ -488,7 +487,7 @@ static const luaL_Reg base_funcs[] = { | |||
488 | {"rawget", luaB_rawget}, | 487 | {"rawget", luaB_rawget}, |
489 | {"rawset", luaB_rawset}, | 488 | {"rawset", luaB_rawset}, |
490 | {"select", luaB_select}, | 489 | {"select", luaB_select}, |
491 | {"setfenv", luaB_setfenv}, | 490 | {"setfenv", luaB_deprecated}, |
492 | {"setmetatable", luaB_setmetatable}, | 491 | {"setmetatable", luaB_setmetatable}, |
493 | {"tonumber", luaB_tonumber}, | 492 | {"tonumber", luaB_tonumber}, |
494 | {"tostring", luaB_tostring}, | 493 | {"tostring", luaB_tostring}, |