aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-10 20:09:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-10 20:09:51 -0200
commit9cd36059ad6f3f6750b8cff54c305ae347c6caca (patch)
tree6b71bb5dab3c7f1e8fec12bc03830b58cdc59fc0 /lapi.c
parent592a309177edc52847b1196969ad6d49ba21f4fb (diff)
downloadlua-9cd36059ad6f3f6750b8cff54c305ae347c6caca.tar.gz
lua-9cd36059ad6f3f6750b8cff54c305ae347c6caca.tar.bz2
lua-9cd36059ad6f3f6750b8cff54c305ae347c6caca.zip
new API functions lua_getstr/lua_setstr
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lapi.c b/lapi.c
index 6e941752..af151636 100644
--- a/lapi.c
+++ b/lapi.c
@@ -329,11 +329,11 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
329*/ 329*/
330 330
331 331
332LUA_API void lua_getglobal (lua_State *L, const char *name) { 332LUA_API void lua_getstr (lua_State *L, int index, const char *name) {
333 TObject o; 333 TObject o;
334 lua_lock(L); 334 lua_lock(L);
335 setsvalue(&o, luaS_new(L, name)); 335 setsvalue(&o, luaS_new(L, name));
336 luaV_gettable(L, gt(L), &o, L->top); 336 luaV_gettable(L, luaA_index(L, index), &o, L->top);
337 api_incr_top(L); 337 api_incr_top(L);
338 lua_unlock(L); 338 lua_unlock(L);
339} 339}
@@ -406,12 +406,12 @@ LUA_API void lua_geteventtable (lua_State *L, int objindex) {
406*/ 406*/
407 407
408 408
409LUA_API void lua_setglobal (lua_State *L, const char *name) { 409LUA_API void lua_setstr (lua_State *L, int index, const char *name) {
410 TObject o; 410 TObject o;
411 lua_lock(L); 411 lua_lock(L);
412 api_checknelems(L, 1); 412 api_checknelems(L, 1);
413 setsvalue(&o, luaS_new(L, name)); 413 setsvalue(&o, luaS_new(L, name));
414 luaV_settable(L, gt(L), &o, L->top - 1); 414 luaV_settable(L, luaA_index(L, index), &o, L->top - 1);
415 L->top--; /* remove element from the top */ 415 L->top--; /* remove element from the top */
416 lua_unlock(L); 416 lua_unlock(L);
417} 417}