summaryrefslogtreecommitdiff
path: root/src/lfunc.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 09:27:51 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-17 09:27:51 +0100
commit50aa5b5029165be03d0cfb34e7d664795dd80898 (patch)
treedc42e1a73ac367fef1a88c3dd0502a0879eebea3 /src/lfunc.js
parent4eea48935f2e0ea1267d314f2900af2a1a4b8b02 (diff)
downloadfengari-50aa5b5029165be03d0cfb34e7d664795dd80898.tar.gz
fengari-50aa5b5029165be03d0cfb34e7d664795dd80898.tar.bz2
fengari-50aa5b5029165be03d0cfb34e7d664795dd80898.zip
More accurate state and closure init
Diffstat (limited to 'src/lfunc.js')
-rw-r--r--src/lfunc.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lfunc.js b/src/lfunc.js
index f3e11d3..39ad049 100644
--- a/src/lfunc.js
+++ b/src/lfunc.js
@@ -88,8 +88,18 @@ const luaF_close = function(L, level) {
}
};
-module.exports.Proto = Proto;
-module.exports.UpVal = UpVal;
-module.exports.findupval = findupval;
-module.exports.luaF_close = luaF_close;
-module.exports.MAXUPVAL = 255; \ No newline at end of file
+const luaF_initupvals = function(L, cl) {
+ for (let i = 0; i < cl.nupvalues; i++) {
+ let uv = new UpVal();
+ uv.refcount = 1;
+ uv.u.value = null;
+ uv.v = uv.u.value;
+ }
+};
+
+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_initupvals = luaF_initupvals; \ No newline at end of file