From de7046f938975dbdcd6cfaba6f535dec53dfc263 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 17 Feb 2017 23:17:35 +0100 Subject: Load std lib, can call print --- src/lbaselib.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lbaselib.js') 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; -- cgit v1.2.3-54-g00ecf