aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-10-10 09:57:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-10-10 09:57:55 -0300
commit533737f26e3f8036d7978e09427ea5ff75aec9df (patch)
tree003004a423cf20bc4e1493918760494b0d694f93
parenta41d60e1d1f3a954648884d4ab7fb7e9ccdd52d6 (diff)
downloadlua-533737f26e3f8036d7978e09427ea5ff75aec9df.tar.gz
lua-533737f26e3f8036d7978e09427ea5ff75aec9df.tar.bz2
lua-533737f26e3f8036d7978e09427ea5ff75aec9df.zip
new functions `lua_getfield' and `lua_setfield'
-rw-r--r--lapi.c29
-rw-r--r--lauxlib.c43
-rw-r--r--lbaselib.c20
-rw-r--r--ldblib.c16
-rw-r--r--liolib.c16
-rw-r--r--lmathlib.c8
-rw-r--r--lua.h4
7 files changed, 70 insertions, 66 deletions
diff --git a/lapi.c b/lapi.c
index b40f984a..16686e7e 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.244 2003/08/27 21:01:44 roberto Exp roberto $ 2** $Id: lapi.c,v 1.245 2003/10/07 20:13:41 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -498,6 +498,19 @@ LUA_API void lua_gettable (lua_State *L, int idx) {
498} 498}
499 499
500 500
501LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
502 StkId t;
503 TObject key;
504 lua_lock(L);
505 t = luaA_index(L, idx);
506 api_checkvalidindex(L, t);
507 setsvalue(&key, luaS_new(L, k));
508 luaV_gettable(L, t, &key, L->top);
509 api_incr_top(L);
510 lua_unlock(L);
511}
512
513
501LUA_API void lua_rawget (lua_State *L, int idx) { 514LUA_API void lua_rawget (lua_State *L, int idx) {
502 StkId t; 515 StkId t;
503 lua_lock(L); 516 lua_lock(L);
@@ -582,6 +595,20 @@ LUA_API void lua_settable (lua_State *L, int idx) {
582} 595}
583 596
584 597
598LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
599 StkId t;
600 TObject key;
601 lua_lock(L);
602 api_checknelems(L, 1);
603 t = luaA_index(L, idx);
604 api_checkvalidindex(L, t);
605 setsvalue(&key, luaS_new(L, k));
606 luaV_settable(L, t, &key, L->top - 1);
607 L->top--; /* pop value */
608 lua_unlock(L);
609}
610
611
585LUA_API void lua_rawset (lua_State *L, int idx) { 612LUA_API void lua_rawset (lua_State *L, int idx) {
586 StkId t; 613 StkId t;
587 lua_lock(L); 614 lua_lock(L);
diff --git a/lauxlib.c b/lauxlib.c
index d689b18d..6aab9a3c 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.104 2003/10/02 20:31:17 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.105 2003/10/07 20:13:41 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -108,15 +108,13 @@ LUALIB_API int luaL_findstring (const char *name, const char *const list[]) {
108 108
109 109
110LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { 110LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
111 lua_pushstring(L, tname); 111 lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
112 lua_rawget(L, LUA_REGISTRYINDEX); /* get registry.name */
113 if (!lua_isnil(L, -1)) /* name already in use? */ 112 if (!lua_isnil(L, -1)) /* name already in use? */
114 return 0; /* leave previous value on top, but return 0 */ 113 return 0; /* leave previous value on top, but return 0 */
115 lua_pop(L, 1); 114 lua_pop(L, 1);
116 lua_newtable(L); /* create metatable */ 115 lua_newtable(L); /* create metatable */
117 lua_pushstring(L, tname); 116 lua_pushvalue(L, -1);
118 lua_pushvalue(L, -2); 117 lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
119 lua_rawset(L, LUA_REGISTRYINDEX); /* registry.name = metatable */
120 lua_pushvalue(L, -1); 118 lua_pushvalue(L, -1);
121 lua_pushstring(L, tname); 119 lua_pushstring(L, tname);
122 lua_rawset(L, LUA_REGISTRYINDEX); /* registry[metatable] = name */ 120 lua_rawset(L, LUA_REGISTRYINDEX); /* registry[metatable] = name */
@@ -125,8 +123,7 @@ LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
125 123
126 124
127LUALIB_API void luaL_getmetatable (lua_State *L, const char *tname) { 125LUALIB_API void luaL_getmetatable (lua_State *L, const char *tname) {
128 lua_pushstring(L, tname); 126 lua_getfield(L, LUA_REGISTRYINDEX, tname);
129 lua_rawget(L, LUA_REGISTRYINDEX);
130} 127}
131 128
132 129
@@ -215,8 +212,7 @@ LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
215LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { 212LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
216 if (!lua_getmetatable(L, obj)) /* no metatable? */ 213 if (!lua_getmetatable(L, obj)) /* no metatable? */
217 return 0; 214 return 0;
218 lua_pushstring(L, event); 215 lua_getfield(L, -1, event);
219 lua_rawget(L, -2);
220 if (lua_isnil(L, -1)) { 216 if (lua_isnil(L, -1)) {
221 lua_pop(L, 2); /* remove metatable and metafield */ 217 lua_pop(L, 2); /* remove metatable and metafield */
222 return 0; 218 return 0;
@@ -241,24 +237,23 @@ LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
241LUALIB_API void luaL_openlib (lua_State *L, const char *libname, 237LUALIB_API void luaL_openlib (lua_State *L, const char *libname,
242 const luaL_reg *l, int nup) { 238 const luaL_reg *l, int nup) {
243 if (libname) { 239 if (libname) {
244 lua_pushstring(L, libname); 240 /* check whether lib already exists */
245 lua_gettable(L, LUA_GLOBALSINDEX); /* check whether lib already exists */ 241 lua_getfield(L, LUA_GLOBALSINDEX, libname);
246 if (lua_isnil(L, -1)) { /* no? */ 242 if (lua_isnil(L, -1)) { /* no? */
247 lua_pop(L, 1); 243 lua_pop(L, 1);
248 lua_newtable(L); /* create it */ 244 lua_newtable(L); /* create it */
249 lua_pushstring(L, libname); 245 lua_pushvalue(L, -1);
250 lua_pushvalue(L, -2); 246 /* register it with given name */
251 lua_settable(L, LUA_GLOBALSINDEX); /* register it with given name */ 247 lua_setfield(L, LUA_GLOBALSINDEX, libname);
252 } 248 }
253 lua_insert(L, -(nup+1)); /* move library table to below upvalues */ 249 lua_insert(L, -(nup+1)); /* move library table to below upvalues */
254 } 250 }
255 for (; l->name; l++) { 251 for (; l->name; l++) {
256 int i; 252 int i;
257 lua_pushstring(L, l->name);
258 for (i=0; i<nup; i++) /* copy upvalues to the top */ 253 for (i=0; i<nup; i++) /* copy upvalues to the top */
259 lua_pushvalue(L, -(nup+1)); 254 lua_pushvalue(L, -nup);
260 lua_pushcclosure(L, l->func, nup); 255 lua_pushcclosure(L, l->func, nup);
261 lua_settable(L, -(nup+3)); 256 lua_setfield(L, -(nup+2), l->name);
262 } 257 }
263 lua_pop(L, nup); /* remove upvalues */ 258 lua_pop(L, nup); /* remove upvalues */
264} 259}
@@ -286,9 +281,8 @@ static void getsizes (lua_State *L) {
286 lua_newtable(L); /* create it */ 281 lua_newtable(L); /* create it */
287 lua_pushvalue(L, -1); /* `size' will be its own metatable */ 282 lua_pushvalue(L, -1); /* `size' will be its own metatable */
288 lua_setmetatable(L, -2); 283 lua_setmetatable(L, -2);
289 lua_pushliteral(L, "__mode");
290 lua_pushliteral(L, "kv"); 284 lua_pushliteral(L, "kv");
291 lua_rawset(L, -3); /* metatable(N).__mode = "kv" */ 285 lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */
292 lua_pushvalue(L, -1); 286 lua_pushvalue(L, -1);
293 lua_rawseti(L, LUA_REGISTRYINDEX, ARRAYSIZE_REF); /* store in register */ 287 lua_rawseti(L, LUA_REGISTRYINDEX, ARRAYSIZE_REF); /* store in register */
294 } 288 }
@@ -297,12 +291,10 @@ static void getsizes (lua_State *L) {
297 291
298void luaL_setn (lua_State *L, int t, int n) { 292void luaL_setn (lua_State *L, int t, int n) {
299 t = abs_index(L, t); 293 t = abs_index(L, t);
300 lua_pushliteral(L, "n"); 294 lua_getfield(L, t, "n");
301 lua_rawget(L, t);
302 if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ 295 if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */
303 lua_pushliteral(L, "n"); /* use it */
304 lua_pushinteger(L, n); 296 lua_pushinteger(L, n);
305 lua_rawset(L, t); 297 lua_setfield(L, t, "n");
306 } 298 }
307 else { /* use `sizes' */ 299 else { /* use `sizes' */
308 getsizes(L); 300 getsizes(L);
@@ -317,8 +309,7 @@ void luaL_setn (lua_State *L, int t, int n) {
317int luaL_getn (lua_State *L, int t) { 309int luaL_getn (lua_State *L, int t) {
318 int n; 310 int n;
319 t = abs_index(L, t); 311 t = abs_index(L, t);
320 lua_pushliteral(L, "n"); /* try t.n */ 312 lua_getfield(L, t, "n"); /* try t.n */
321 lua_rawget(L, t);
322 if ((n = checkint(L, 1)) >= 0) return n; 313 if ((n = checkint(L, 1)) >= 0) return n;
323 getsizes(L); /* else try sizes[t] */ 314 getsizes(L); /* else try sizes[t] */
324 lua_pushvalue(L, t); 315 lua_pushvalue(L, t);
diff --git a/lbaselib.c b/lbaselib.c
index cac980a0..b552fa4b 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.133 2003/08/27 21:02:08 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.134 2003/10/07 20:13:41 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -220,8 +220,7 @@ static int luaB_next (lua_State *L) {
220 220
221static int luaB_pairs (lua_State *L) { 221static int luaB_pairs (lua_State *L) {
222 luaL_checktype(L, 1, LUA_TTABLE); 222 luaL_checktype(L, 1, LUA_TTABLE);
223 lua_pushliteral(L, "next"); 223 lua_getfield(L, LUA_GLOBALSINDEX, "next"); /* return generator, */
224 lua_rawget(L, LUA_GLOBALSINDEX); /* return generator, */
225 lua_pushvalue(L, 1); /* state, */ 224 lua_pushvalue(L, 1); /* state, */
226 lua_pushnil(L); /* and initial value */ 225 lua_pushnil(L); /* and initial value */
227 return 3; 226 return 3;
@@ -232,8 +231,7 @@ static int luaB_ipairs (lua_State *L) {
232 int i = (int)lua_tointeger(L, 2); 231 int i = (int)lua_tointeger(L, 2);
233 luaL_checktype(L, 1, LUA_TTABLE); 232 luaL_checktype(L, 1, LUA_TTABLE);
234 if (i == 0 && lua_isnone(L, 2)) { /* `for' start? */ 233 if (i == 0 && lua_isnone(L, 2)) { /* `for' start? */
235 lua_pushliteral(L, "ipairs"); 234 lua_getfield(L, LUA_GLOBALSINDEX, "ipairs"); /* return generator, */
236 lua_rawget(L, LUA_GLOBALSINDEX); /* return generator, */
237 lua_pushvalue(L, 1); /* state, */ 235 lua_pushvalue(L, 1); /* state, */
238 lua_pushinteger(L, 0); /* and initial value */ 236 lua_pushinteger(L, 0); /* and initial value */
239 return 3; 237 return 3;
@@ -693,23 +691,19 @@ static const luaL_reg co_funcs[] = {
693 691
694 692
695static void base_open (lua_State *L) { 693static void base_open (lua_State *L) {
696 lua_pushliteral(L, "_G");
697 lua_pushvalue(L, LUA_GLOBALSINDEX); 694 lua_pushvalue(L, LUA_GLOBALSINDEX);
698 luaL_openlib(L, NULL, base_funcs, 0); /* open lib into global table */ 695 luaL_openlib(L, NULL, base_funcs, 0); /* open lib into global table */
699 lua_pushliteral(L, "_VERSION");
700 lua_pushliteral(L, LUA_VERSION); 696 lua_pushliteral(L, LUA_VERSION);
701 lua_rawset(L, -3); /* set global _VERSION */ 697 lua_setfield(L, -2, "_VERSION"); /* set global _VERSION */
702 /* `newproxy' needs a weaktable as upvalue */ 698 /* `newproxy' needs a weaktable as upvalue */
703 lua_pushliteral(L, "newproxy");
704 lua_newtable(L); /* new table `w' */ 699 lua_newtable(L); /* new table `w' */
705 lua_pushvalue(L, -1); /* `w' will be its own metatable */ 700 lua_pushvalue(L, -1); /* `w' will be its own metatable */
706 lua_setmetatable(L, -2); 701 lua_setmetatable(L, -2);
707 lua_pushliteral(L, "__mode");
708 lua_pushliteral(L, "kv"); 702 lua_pushliteral(L, "kv");
709 lua_rawset(L, -3); /* metatable(w).__mode = "kv" */ 703 lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */
710 lua_pushcclosure(L, luaB_newproxy, 1); 704 lua_pushcclosure(L, luaB_newproxy, 1);
711 lua_rawset(L, -3); /* set global `newproxy' */ 705 lua_setfield(L, -2, "newproxy"); /* set global `newproxy' */
712 lua_rawset(L, -1); /* set global _G */ 706 lua_setfield(L, -1, "_G"); /* set global _G */
713} 707}
714 708
715 709
diff --git a/ldblib.c b/ldblib.c
index ba7237c2..440b4a9c 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.81 2003/07/07 13:37:08 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.82 2003/10/07 20:13:41 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -19,16 +19,14 @@
19 19
20 20
21static void settabss (lua_State *L, const char *i, const char *v) { 21static void settabss (lua_State *L, const char *i, const char *v) {
22 lua_pushstring(L, i);
23 lua_pushstring(L, v); 22 lua_pushstring(L, v);
24 lua_rawset(L, -3); 23 lua_setfield(L, -2, i);
25} 24}
26 25
27 26
28static void settabsi (lua_State *L, const char *i, int v) { 27static void settabsi (lua_State *L, const char *i, int v) {
29 lua_pushstring(L, i);
30 lua_pushinteger(L, v); 28 lua_pushinteger(L, v);
31 lua_rawset(L, -3); 29 lua_setfield(L, -2, i);
32} 30}
33 31
34 32
@@ -85,12 +83,11 @@ static int getinfo (lua_State *L) {
85 settabss(L, "namewhat", ar.namewhat); 83 settabss(L, "namewhat", ar.namewhat);
86 break; 84 break;
87 case 'f': 85 case 'f':
88 lua_pushliteral(L, "func");
89 if (L == L1) 86 if (L == L1)
90 lua_pushvalue(L, -3); 87 lua_pushvalue(L, -2);
91 else 88 else
92 lua_xmove(L1, L, 1); 89 lua_xmove(L1, L, 1);
93 lua_rawset(L, -3); 90 lua_setfield(L, -2, "func");
94 break; 91 break;
95 } 92 }
96 } 93 }
@@ -341,9 +338,8 @@ static const luaL_reg dblib[] = {
341 338
342LUALIB_API int luaopen_debug (lua_State *L) { 339LUALIB_API int luaopen_debug (lua_State *L) {
343 luaL_openlib(L, LUA_DBLIBNAME, dblib, 0); 340 luaL_openlib(L, LUA_DBLIBNAME, dblib, 0);
344 lua_pushliteral(L, "_TRACEBACK");
345 lua_pushcfunction(L, errorfb); 341 lua_pushcfunction(L, errorfb);
346 lua_settable(L, LUA_GLOBALSINDEX); 342 lua_setfield(L, LUA_GLOBALSINDEX, "_TRACEBACK");
347 return 1; 343 return 1;
348} 344}
349 345
diff --git a/liolib.c b/liolib.c
index 29c60f00..3846360a 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.46 2003/08/25 19:49:47 roberto Exp roberto $ 2** $Id: liolib.c,v 2.47 2003/10/07 20:13:41 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -236,8 +236,7 @@ static int io_readline (lua_State *L);
236 236
237 237
238static void aux_lines (lua_State *L, int idx, int close) { 238static void aux_lines (lua_State *L, int idx, int close) {
239 lua_pushliteral(L, FILEHANDLE); 239 lua_getfield(L, LUA_REGISTRYINDEX, FILEHANDLE);
240 lua_rawget(L, LUA_REGISTRYINDEX);
241 lua_pushvalue(L, idx); 240 lua_pushvalue(L, idx);
242 lua_pushboolean(L, close); /* close/not close file when finished */ 241 lua_pushboolean(L, close); /* close/not close file when finished */
243 lua_pushcclosure(L, io_readline, 3); 242 lua_pushcclosure(L, io_readline, 3);
@@ -512,9 +511,8 @@ static void createmeta (lua_State *L) {
512 *newfile(L) = stdout; 511 *newfile(L) = stdout;
513 lua_rawseti(L, -2, IO_OUTPUT); 512 lua_rawseti(L, -2, IO_OUTPUT);
514 /* file methods */ 513 /* file methods */
515 lua_pushliteral(L, "__index"); 514 lua_pushvalue(L, -1); /* push metatable */
516 lua_pushvalue(L, -2); /* push metatable */ 515 lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
517 lua_rawset(L, -3); /* metatable.__index = metatable */
518 luaL_openlib(L, NULL, flib, 0); 516 luaL_openlib(L, NULL, flib, 0);
519} 517}
520 518
@@ -594,8 +592,7 @@ static void setboolfield (lua_State *L, const char *key, int value) {
594 592
595static int getboolfield (lua_State *L, const char *key) { 593static int getboolfield (lua_State *L, const char *key) {
596 int res; 594 int res;
597 lua_pushstring(L, key); 595 lua_getfield(L, -1, key);
598 lua_gettable(L, -2);
599 res = lua_toboolean(L, -1); 596 res = lua_toboolean(L, -1);
600 lua_pop(L, 1); 597 lua_pop(L, 1);
601 return res; 598 return res;
@@ -604,8 +601,7 @@ static int getboolfield (lua_State *L, const char *key) {
604 601
605static int getfield (lua_State *L, const char *key, int d) { 602static int getfield (lua_State *L, const char *key, int d) {
606 int res; 603 int res;
607 lua_pushstring(L, key); 604 lua_getfield(L, -1, key);
608 lua_gettable(L, -2);
609 if (lua_isnumber(L, -1)) 605 if (lua_isnumber(L, -1))
610 res = (int)lua_tointeger(L, -1); 606 res = (int)lua_tointeger(L, -1);
611 else { 607 else {
diff --git a/lmathlib.c b/lmathlib.c
index 6afbcab6..c9397376 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.56 2003/03/11 12:30:37 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.57 2003/10/07 20:13:41 roberto Exp roberto $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -235,12 +235,10 @@ static const luaL_reg mathlib[] = {
235*/ 235*/
236LUALIB_API int luaopen_math (lua_State *L) { 236LUALIB_API int luaopen_math (lua_State *L) {
237 luaL_openlib(L, LUA_MATHLIBNAME, mathlib, 0); 237 luaL_openlib(L, LUA_MATHLIBNAME, mathlib, 0);
238 lua_pushliteral(L, "pi");
239 lua_pushnumber(L, PI); 238 lua_pushnumber(L, PI);
240 lua_settable(L, -3); 239 lua_setfield(L, -2, "pi");
241 lua_pushliteral(L, "__pow");
242 lua_pushcfunction(L, math_pow); 240 lua_pushcfunction(L, math_pow);
243 lua_settable(L, LUA_GLOBALSINDEX); 241 lua_setfield(L, LUA_GLOBALSINDEX, "__pow");
244 return 1; 242 return 1;
245} 243}
246 244
diff --git a/lua.h b/lua.h
index b0b80f43..4e4d5c45 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.179 2003/10/02 20:31:17 roberto Exp roberto $ 2** $Id: lua.h,v 1.180 2003/10/07 20:13:41 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** http://www.lua.org mailto:info@lua.org
@@ -182,6 +182,7 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p);
182** get functions (Lua -> stack) 182** get functions (Lua -> stack)
183*/ 183*/
184LUA_API void lua_gettable (lua_State *L, int idx); 184LUA_API void lua_gettable (lua_State *L, int idx);
185LUA_API void lua_getfield (lua_State *L, int idx, const char *k);
185LUA_API void lua_rawget (lua_State *L, int idx); 186LUA_API void lua_rawget (lua_State *L, int idx);
186LUA_API void lua_rawgeti (lua_State *L, int idx, int n); 187LUA_API void lua_rawgeti (lua_State *L, int idx, int n);
187LUA_API void lua_newtable (lua_State *L); 188LUA_API void lua_newtable (lua_State *L);
@@ -194,6 +195,7 @@ LUA_API void lua_getfenv (lua_State *L, int idx);
194** set functions (stack -> Lua) 195** set functions (stack -> Lua)
195*/ 196*/
196LUA_API void lua_settable (lua_State *L, int idx); 197LUA_API void lua_settable (lua_State *L, int idx);
198LUA_API void lua_setfield (lua_State *L, int idx, const char *k);
197LUA_API void lua_rawset (lua_State *L, int idx); 199LUA_API void lua_rawset (lua_State *L, int idx);
198LUA_API void lua_rawseti (lua_State *L, int idx, int n); 200LUA_API void lua_rawseti (lua_State *L, int idx, int n);
199LUA_API int lua_setmetatable (lua_State *L, int objindex); 201LUA_API int lua_setmetatable (lua_State *L, int objindex);