summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-15 22:13:01 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-15 22:19:14 +0100
commit9d6afeba223c22163928557c69a102877223d3bd (patch)
tree481efe9bfaf1095792ca1612603ef3505352d1f8 /src/lapi.js
parent43474e4c411709e3c1ab1b1d13283d2bc4789d1d (diff)
downloadfengari-9d6afeba223c22163928557c69a102877223d3bd.tar.gz
fengari-9d6afeba223c22163928557c69a102877223d3bd.tar.bz2
fengari-9d6afeba223c22163928557c69a102877223d3bd.zip
Everything need to make luaL_newstate work, lua_pushnil test
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js14
1 files changed, 14 insertions, 0 deletions
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