diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-10 20:09:51 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-10 20:09:51 -0200 |
| commit | 9cd36059ad6f3f6750b8cff54c305ae347c6caca (patch) | |
| tree | 6b71bb5dab3c7f1e8fec12bc03830b58cdc59fc0 /lapi.c | |
| parent | 592a309177edc52847b1196969ad6d49ba21f4fb (diff) | |
| download | lua-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.c | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -329,11 +329,11 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
| 329 | */ | 329 | */ |
| 330 | 330 | ||
| 331 | 331 | ||
| 332 | LUA_API void lua_getglobal (lua_State *L, const char *name) { | 332 | LUA_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 | ||
| 409 | LUA_API void lua_setglobal (lua_State *L, const char *name) { | 409 | LUA_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 | } |
