aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/lapi.c b/lapi.c
index 9ba82982..d3e95007 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.232 2014/07/30 14:00:14 roberto Exp roberto $ 2** $Id: lapi.c,v 2.233 2014/08/01 17:33:08 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*/
@@ -611,6 +611,18 @@ LUA_API int lua_getfield (lua_State *L, int idx, const char *k) {
611} 611}
612 612
613 613
614LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) {
615 StkId t;
616 lua_lock(L);
617 t = index2addr(L, idx);
618 setivalue(L->top, n);
619 api_incr_top(L);
620 luaV_gettable(L, t, L->top - 1, L->top - 1);
621 lua_unlock(L);
622 return ttnov(L->top - 1);
623}
624
625
614LUA_API int lua_rawget (lua_State *L, int idx) { 626LUA_API int lua_rawget (lua_State *L, int idx) {
615 StkId t; 627 StkId t;
616 lua_lock(L); 628 lua_lock(L);
@@ -743,6 +755,18 @@ LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
743} 755}
744 756
745 757
758LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) {
759 StkId t;
760 lua_lock(L);
761 api_checknelems(L, 1);
762 t = index2addr(L, idx);
763 setivalue(L->top++, n);
764 luaV_settable(L, t, L->top - 1, L->top - 2);
765 L->top -= 2; /* pop value and key */
766 lua_unlock(L);
767}
768
769
746LUA_API void lua_rawset (lua_State *L, int idx) { 770LUA_API void lua_rawset (lua_State *L, int idx) {
747 StkId o; 771 StkId o;
748 Table *t; 772 Table *t;