summaryrefslogtreecommitdiff
path: root/sandbox
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-02 22:38:35 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-03 07:07:35 +0100
commit7b844c5caf81ac843a210477ef47fd16e8af2f2c (patch)
tree5464f83feb24355ebe67f8d0f4b41a1a76227ad0 /sandbox
parent9f222971e304d4ec03a3af9015744530f2c8793d (diff)
downloadfengari-7b844c5caf81ac843a210477ef47fd16e8af2f2c.tar.gz
fengari-7b844c5caf81ac843a210477ef47fd16e8af2f2c.tar.bz2
fengari-7b844c5caf81ac843a210477ef47fd16e8af2f2c.zip
Lua VM
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/hello.bc.txt17
-rw-r--r--sandbox/hello.js3
2 files changed, 18 insertions, 2 deletions
diff --git a/sandbox/hello.bc.txt b/sandbox/hello.bc.txt
new file mode 100644
index 0000000..b41f555
--- /dev/null
+++ b/sandbox/hello.bc.txt
@@ -0,0 +1,17 @@
+main <sandbox/hello2.lua:0,0> (9 instructions at 0x7ff931403170)
+0+ params, 5 slots, 1 upvalue, 2 locals, 4 constants, 1 function
+ 1 [1] LOADK 0 -1 ; 1
+ 2 [2] LOADK 1 -2 ; 2
+ 3 [3] GETTABUP 2 0 -3 ; _ENV "print"
+ 4 [3] MOVE 3 0
+ 5 [3] MOVE 4 1
+ 6 [3] CALL 2 3 1
+ 7 [7] CLOSURE 2 0 ; 0x7ff9314032e0
+ 8 [5] SETTABUP 0 -4 2 ; _ENV "c"
+ 9 [7] RETURN 0 1
+
+function <sandbox/hello2.lua:5,7> (3 instructions at 0x7ff9314032e0)
+2 params, 3 slots, 0 upvalues, 2 locals, 0 constants, 0 functions
+ 1 [6] ADD 2 0 1
+ 2 [6] RETURN 2 2
+ 3 [7] RETURN 0 1 \ No newline at end of file
diff --git a/sandbox/hello.js b/sandbox/hello.js
index f8f6e15..df32dd8 100644
--- a/sandbox/hello.js
+++ b/sandbox/hello.js
@@ -2,7 +2,6 @@ const DataView = require('buffer-dataview');
const fs = require('fs');
const BytecodeParser = require("../src/lundump.js");
-const lua_State = require('../src/lstate.js').lua_State;
-let p = new BytecodeParser(new lua_State(), new DataView(fs.readFileSync("./sandbox/hello.bc")))
+let p = new BytecodeParser(new DataView(fs.readFileSync("./sandbox/hello.bc")))
p.luaU_undump(); \ No newline at end of file