diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-07 15:25:36 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-07 15:25:36 -0200 |
commit | 86a4de256e88844e34535901d25923aa851d963e (patch) | |
tree | 99f8cd31a5199f4c0a20dfb5c290f361887f90c5 /lbaselib.c | |
parent | 53aaee6ee65bee24e3ce05c35fcdd002b4ef0658 (diff) | |
download | lua-86a4de256e88844e34535901d25923aa851d963e.tar.gz lua-86a4de256e88844e34535901d25923aa851d963e.tar.bz2 lua-86a4de256e88844e34535901d25923aa851d963e.zip |
no more lua_[gs]etstr
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -20,8 +20,9 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | static void aux_setn (lua_State *L, int t, int n) { | 22 | static void aux_setn (lua_State *L, int t, int n) { |
23 | lua_pushliteral(L, "n"); | ||
23 | lua_pushnumber(L, n); | 24 | lua_pushnumber(L, n); |
24 | lua_setstr(L, t, "n"); | 25 | lua_rawset(L, t); |
25 | } | 26 | } |
26 | 27 | ||
27 | 28 | ||
@@ -444,7 +445,8 @@ static int luaB_coroutine (lua_State *L) { | |||
444 | } | 445 | } |
445 | lua_cobegin(NL, n-1); | 446 | lua_cobegin(NL, n-1); |
446 | lua_newuserdatabox(L, NL); | 447 | lua_newuserdatabox(L, NL); |
447 | lua_getstr(L, LUA_REGISTRYINDEX, "Coroutine"); | 448 | lua_pushliteral(L, "Coroutine"); |
449 | lua_rawget(L, LUA_REGISTRYINDEX); | ||
448 | lua_setmetatable(L, -2); | 450 | lua_setmetatable(L, -2); |
449 | lua_pushcclosure(L, luaB_resume, 1); | 451 | lua_pushcclosure(L, luaB_resume, 1); |
450 | return 1; | 452 | return 1; |
@@ -700,10 +702,12 @@ LUALIB_API int lua_baselibopen (lua_State *L) { | |||
700 | lua_pushcclosure(L, luaB_require, 1); | 702 | lua_pushcclosure(L, luaB_require, 1); |
701 | lua_setglobal(L, "require"); | 703 | lua_setglobal(L, "require"); |
702 | /* create metatable for coroutines */ | 704 | /* create metatable for coroutines */ |
705 | lua_pushliteral(L, "Coroutine"); | ||
703 | lua_newtable(L); | 706 | lua_newtable(L); |
707 | lua_pushliteral(L, "gc"); | ||
704 | lua_pushcfunction(L, gc_coroutine); | 708 | lua_pushcfunction(L, gc_coroutine); |
705 | lua_setstr(L, -2, "gc"); | 709 | lua_rawset(L, -3); |
706 | lua_setstr(L, LUA_REGISTRYINDEX, "Coroutine"); | 710 | lua_rawset(L, LUA_REGISTRYINDEX); |
707 | return 0; | 711 | return 0; |
708 | } | 712 | } |
709 | 713 | ||