diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-20 17:40:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-20 17:40:38 -0300 |
commit | 5610fdd776edd0de71864f79d50b4526df861d75 (patch) | |
tree | 05626ef39933244416faffdb398c167c1372b1cd | |
parent | b449a5e574874f053859db3da18599b8b968e4e9 (diff) | |
download | lua-5610fdd776edd0de71864f79d50b4526df861d75.tar.gz lua-5610fdd776edd0de71864f79d50b4526df861d75.tar.bz2 lua-5610fdd776edd0de71864f79d50b4526df861d75.zip |
avoid using obsolete lua_dostring
-rw-r--r-- | ltests.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.125 2002/06/13 13:44:50 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.126 2002/06/18 15:19:27 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -478,11 +478,14 @@ static int closestate (lua_State *L) { | |||
478 | } | 478 | } |
479 | 479 | ||
480 | static int doremote (lua_State *L) { | 480 | static int doremote (lua_State *L) { |
481 | lua_State *L1; | 481 | lua_State *L1 = cast(lua_State *,cast(unsigned long,luaL_check_number(L, 1))); |
482 | const char *code = luaL_check_string(L, 2); | 482 | size_t lcode; |
483 | const char *code = luaL_check_lstr(L, 2, &lcode); | ||
483 | int status; | 484 | int status; |
484 | L1 = cast(lua_State *, cast(unsigned long, luaL_check_number(L, 1))); | 485 | lua_settop(L1, 0); |
485 | status = lua_dostring(L1, code); | 486 | status = luaL_loadbuffer(L1, code, lcode, code); |
487 | if (status == 0) | ||
488 | status = lua_pcall(L1, 0, LUA_MULTRET); | ||
486 | if (status != 0) { | 489 | if (status != 0) { |
487 | lua_pushnil(L); | 490 | lua_pushnil(L); |
488 | lua_pushnumber(L, status); | 491 | lua_pushnumber(L, status); |