summaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-02 21:15:42 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-03 14:39:45 +0100
commit0ba3c5d516b1a0b67cff6d5f4b4583284086dd4b (patch)
tree72db338fe02e0e4b84238a54e422bbc21b40a5d0 /src/lauxlib.js
parent319c40c4439a9eda7bd4a68769057cb12b04755a (diff)
downloadfengari-0ba3c5d516b1a0b67cff6d5f4b4583284086dd4b.tar.gz
fengari-0ba3c5d516b1a0b67cff6d5f4b4583284086dd4b.tar.bz2
fengari-0ba3c5d516b1a0b67cff6d5f4b4583284086dd4b.zip
load, luaL_loadbuffer(x), luaL_loadstring, lua_replace, lua_isnone, lua_isnoneornil, lua_setupvalue
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 728469a..d58a171 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -225,6 +225,24 @@ const luaL_opt = function(L, f, n, d) {
return lapi.lua_type(L, n) <= 0 ? d : f(L, n);
};
+const getS = function(L, ud) {
+ let s = ud.string;
+ ud.string = null;
+ return s;
+};
+
+const luaL_loadbufferx = function(L, buff, size, name, mode) {
+ return lapi.lua_load(L, getS, {string: buff}, name, mode);
+};
+
+const luaL_loadbuffer = function(L, s, sz, n) {
+ return luaL_loadbufferx(L, s, sz, n, null);
+};
+
+const luaL_loadstring = function(L, s) {
+ return luaL_loadbuffer(L, s, s.length, s);
+};
+
const luaL_getmetafield = function(L, obj, event) {
if (!lapi.lua_getmetatable(L, obj))
return CT.LUA_TNIL;
@@ -381,6 +399,9 @@ module.exports.luaL_error = luaL_error;
module.exports.luaL_getmetafield = luaL_getmetafield;
module.exports.luaL_getsubtable = luaL_getsubtable;
module.exports.luaL_len = luaL_len;
+module.exports.luaL_loadbuffer = luaL_loadbuffer;
+module.exports.luaL_loadbufferx = luaL_loadbufferx;
+module.exports.luaL_loadstring = luaL_loadstring;
module.exports.luaL_newlib = luaL_newlib;
module.exports.luaL_newstate = luaL_newstate;
module.exports.luaL_opt = luaL_opt;