From 86a4de256e88844e34535901d25923aa851d963e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 7 Feb 2002 15:25:36 -0200 Subject: no more lua_[gs]etstr --- ldblib.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'ldblib.c') diff --git a/ldblib.c b/ldblib.c index 27131a9b..58eb56c9 100644 --- a/ldblib.c +++ b/ldblib.c @@ -18,14 +18,16 @@ static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, i); lua_pushstring(L, v); - lua_setstr(L, -2, i); + lua_rawset(L, -3); } static void settabsi (lua_State *L, const char *i, int v) { + lua_pushstring(L, i); lua_pushnumber(L, v); - lua_setstr(L, -2, i); + lua_rawset(L, -3); } @@ -69,8 +71,9 @@ static int getinfo (lua_State *L) { settabss(L, "namewhat", ar.namewhat); break; case 'f': - lua_pushvalue(L, -2); - lua_setstr(L, -2, "func"); + lua_pushliteral(L, "func"); + lua_pushvalue(L, -3); + lua_rawset(L, -3); break; } } @@ -112,7 +115,8 @@ static int setlocal (lua_State *L) { static void hookf (lua_State *L, const char *key) { - lua_getstr(L, LUA_REGISTRYINDEX, key); + lua_pushstring(L, key); + lua_rawget(L, LUA_REGISTRYINDEX); if (lua_isfunction(L, -1)) { lua_pushvalue(L, -2); /* original argument (below function) */ lua_rawcall(L, 1, 0); @@ -143,9 +147,11 @@ static void sethook (lua_State *L, const char *key, lua_Hook hook, (*sethookf)(L, hook); else luaL_argerror(L, 1, "function expected"); - lua_getstr(L, LUA_REGISTRYINDEX, key); /* get old value */ + lua_pushstring(L, key); + lua_rawget(L, LUA_REGISTRYINDEX); /* get old value */ + lua_pushstring(L, key); lua_pushvalue(L, 1); - lua_setstr(L, LUA_REGISTRYINDEX, key); /* set new value */ + lua_rawset(L, LUA_REGISTRYINDEX); /* set new value */ } -- cgit v1.2.3-55-g6feb