summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
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