diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-20 11:58:46 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-20 12:03:47 +0100 |
commit | 6d3d22b3938a811bdde9a311753837003df42d08 (patch) | |
tree | 11a8c9943d4ba6295200fe906c54333732aa37b2 /src/lbaselib.js | |
parent | e0d4ffcc75a04b3ecc2cc08aea372d9621e5b6ac (diff) | |
download | fengari-6d3d22b3938a811bdde9a311753837003df42d08.tar.gz fengari-6d3d22b3938a811bdde9a311753837003df42d08.tar.bz2 fengari-6d3d22b3938a811bdde9a311753837003df42d08.zip |
rawset, rawget
Diffstat (limited to 'src/lbaselib.js')
-rw-r--r-- | src/lbaselib.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js index 62d25df..a89cf9d 100644 --- a/src/lbaselib.js +++ b/src/lbaselib.js @@ -64,12 +64,31 @@ const luaB_rawequal = function(L) { return 1; }; +const luaB_rawget = function(L) { + lauxlib.luaL_checktype(L, 1, CT.LUA_TTABLE); + lauxlib.luaL_checkany(L, 2); + lapi.lua_settop(L, 2); + lapi.lua_rawget(L, 1); + return 1; +}; + +const luaB_rawset = function(L) { + lauxlib.luaL_checktype(L, 1, CT.LUA_TTABLE); + lauxlib.luaL_checkany(L, 2); + lauxlib.luaL_checkany(L, 3); + lapi.lua_settop(L, 3); + lapi.lua_rawset(L, 1); + return 1; +}; + const base_funcs = { "print": luaB_print, "tostring": luaB_tostring, "getmetatable": luaB_getmetatable, "setmetatable": luaB_setmetatable, "rawequal": luaB_rawequal, + "rawset": luaB_rawset, + "rawget": luaB_rawget, }; const luaopen_base = function(L) { |