summaryrefslogtreecommitdiff
path: root/src/lauxlib.js
blob: 6cc3d3cd42830712942cdc3bb9eb66a69c3ca0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*jshint esversion: 6 */
"use strict";

const assert = require('assert');

const lstate = require('./lstate.js');
const lapi   = require('./lapi.js');

const panic = function(L) {
    console.log(`PANIC: unprotected error in call to Lua API (...)`);
    return 0;
}

const luaL_newstate = function() {
    let L = lstate.lua_newstate();
    if (L) lapi.lua_atpanic(L, panic);
    return L;
};


const luaL_typename = function(L, i) {
    return lapi.lua_typename(L, lapi.lua_type(L, i));
}


module.exports.luaL_newstate = luaL_newstate;
module.exports.luaL_typename = luaL_typename;