commit 5610fdd776edd0de71864f79d50b4526df861d75
parent b449a5e574874f053859db3da18599b8b968e4e9
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 20 Jun 2002 17:40:16 -0300
avoid using obsolete lua_dostring
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/ltests.c b/ltests.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltests.c,v 1.125 2002/06/13 13:44:50 roberto Exp roberto $
+** $Id: ltests.c,v 1.126 2002/06/18 15:19:27 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@@ -478,11 +478,14 @@ static int closestate (lua_State *L) {
}
static int doremote (lua_State *L) {
- lua_State *L1;
- const char *code = luaL_check_string(L, 2);
+ lua_State *L1 = cast(lua_State *,cast(unsigned long,luaL_check_number(L, 1)));
+ size_t lcode;
+ const char *code = luaL_check_lstr(L, 2, &lcode);
int status;
- L1 = cast(lua_State *, cast(unsigned long, luaL_check_number(L, 1)));
- status = lua_dostring(L1, code);
+ lua_settop(L1, 0);
+ status = luaL_loadbuffer(L1, code, lcode, code);
+ if (status == 0)
+ status = lua_pcall(L1, 0, LUA_MULTRET);
if (status != 0) {
lua_pushnil(L);
lua_pushnumber(L, status);