summaryrefslogtreecommitdiff
path: root/src/lbaselib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-17 23:17:35 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-17 23:17:35 +0100
commitde7046f938975dbdcd6cfaba6f535dec53dfc263 (patch)
treea68589e7ff126c8f62cf20773b6b531c5b833f59 /src/lbaselib.js
parent06ec7904c37b897b2e87f4321198926ff22da1d9 (diff)
downloadfengari-de7046f938975dbdcd6cfaba6f535dec53dfc263.tar.gz
fengari-de7046f938975dbdcd6cfaba6f535dec53dfc263.tar.bz2
fengari-de7046f938975dbdcd6cfaba6f535dec53dfc263.zip
Load std lib, can call print
Diffstat (limited to 'src/lbaselib.js')
-rw-r--r--src/lbaselib.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js
index d28a3d5..b046f67 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -3,6 +3,7 @@
const assert = require('assert');
+const lua = require('./lua.js');
const lapi = require('./lapi.js');
const lauxlib = require('./lauxlib.js');
@@ -15,7 +16,7 @@ const luaB_print = function(L) {
lapi.lua_pushvalue(L, -1); /* function to be called */
lapi.lua_pushvalue(L, i); /* value to print */
lapi.lua_call(L, 1, 1);
- s = lapi.lua_tolstring(L, -1, null);
+ let s = lapi.lua_tolstring(L, -1, null);
if (s === null)
throw new Error("'tostring' must return a string to 'print");
if (i > 1) s = `\t${s}`;
@@ -53,4 +54,5 @@ const luaopen_base = function(L) {
};
module.exports.luaB_tostring = luaB_tostring;
-module.exports.luaB_print = luaB_print;
+module.exports.luaB_print = luaB_print;
+module.exports.luaopen_base = luaopen_base;