summaryrefslogtreecommitdiff
path: root/src/lfunc.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-27 15:08:09 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-27 15:08:09 +0100
commit6beeccbd0a859f3a9d1be4142d16a3d11ac30743 (patch)
tree0d6c8ded314a0b3e3c989952e4dbdff6a27048b3 /src/lfunc.js
parent5a47025d64f013975051473c1115ff70c0281785 (diff)
downloadfengari-6beeccbd0a859f3a9d1be4142d16a3d11ac30743.tar.gz
fengari-6beeccbd0a859f3a9d1be4142d16a3d11ac30743.tar.bz2
fengari-6beeccbd0a859f3a9d1be4142d16a3d11ac30743.zip
Basic lexing tests
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