summaryrefslogtreecommitdiff
path: root/src/lfunc.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lfunc.js')
-rw-r--r--src/lfunc.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lfunc.js b/src/lfunc.js
index 3b3c8ce..fde910b 100644
--- a/src/lfunc.js
+++ b/src/lfunc.js
@@ -1,6 +1,8 @@
/*jshint esversion: 6 */
"use strict";
-const assert = require('assert');
+const assert = require('assert');
+
+const lobject = require('./lobject.js');
class Proto {
@@ -53,6 +55,15 @@ class UpVal {
}
+const luaF_newLclosure = function(L, n) {
+ let c = new lobject.LClosure();
+ c.p = null;
+ c.nupvalues = n;
+ while (n--) c.upvals[n] = null;
+ return c;
+};
+
+
const findupval = function(L, level) {
let pp = L.openupval;
@@ -116,10 +127,11 @@ const luaF_getlocalname = function(f, local_number, pc) {
}
+module.exports.MAXUPVAL = 255;
module.exports.Proto = Proto;
module.exports.UpVal = UpVal;
module.exports.findupval = findupval;
module.exports.luaF_close = luaF_close;
-module.exports.MAXUPVAL = 255;
+module.exports.luaF_getlocalname = luaF_getlocalname
module.exports.luaF_initupvals = luaF_initupvals;
-module.exports.luaF_getlocalname = luaF_getlocalname \ No newline at end of file
+module.exports.luaF_newLclosure = luaF_newLclosure; \ No newline at end of file