From 9d6afeba223c22163928557c69a102877223d3bd Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 15 Feb 2017 22:13:01 +0100 Subject: Everything need to make luaL_newstate work, lua_pushnil test --- src/lapi.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/lapi.js') diff --git a/src/lapi.js b/src/lapi.js index eecf1ab..9e20d7f 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -2,6 +2,7 @@ "use strict"; const assert = require('assert'); + const ldo = require('./ldo.js'); const lobject = require('./lobject.js'); const lfunc = require('./lfunc.js'); @@ -15,6 +16,17 @@ const l_isfalse = lobject.l_isfalse; const TValue = lobject.TValue; const CClosure = lobject.CClosure; +const lua_version = function(L) { + if (L === null) return lua.LUA_VERSION_NUM; + else return L.l_G.version; +}; + +const lua_atpanic = function(L, panicf) { + let old = L.l_G.panic; + L.l_G.panic = panicf; + return old; +}; + // Return real index on stack const index2addr = function(L, idx) { let ci = L.ci; @@ -212,3 +224,5 @@ module.exports.lua_pushnumber = lua_pushnumber; module.exports.lua_pushinteger = lua_pushinteger; module.exports.lua_pushlstring = lua_pushlstring; module.exports.lua_pushstring = lua_pushstring; +module.exports.lua_version = lua_version; +module.exports.lua_atpanic = lua_atpanic; \ No newline at end of file -- cgit v1.2.3-54-g00ecf