summaryrefslogtreecommitdiff
path: root/src/lundump.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-26 16:56:48 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-26 17:06:43 +1000
commitef7bc7c1f8684af04da5d9e91fecf6ce82ecf397 (patch)
tree755d5fbf73d257b8d66aefe467c8918eed43649a /src/lundump.js
parentf795975870b29082b72c1c8b3c461233c833e09a (diff)
downloadfengari-ef7bc7c1f8684af04da5d9e91fecf6ce82ecf397.tar.gz
fengari-ef7bc7c1f8684af04da5d9e91fecf6ce82ecf397.tar.bz2
fengari-ef7bc7c1f8684af04da5d9e91fecf6ce82ecf397.zip
All core files reference defs.js instead of lua.js
Diffstat (limited to 'src/lundump.js')
-rw-r--r--src/lundump.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lundump.js b/src/lundump.js
index b229926..e2daf6e 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -4,7 +4,7 @@
const fs = require('fs');
const assert = require('assert');
-const lua = require('./lua.js');
+const defs = require('./defs.js');
const lobject = require('./lobject.js');
const Proto = require('./lfunc.js').Proto;
const OpCodes = require('./lopcodes.js');
@@ -161,25 +161,25 @@ class BytecodeParser {
readConstants(f) {
let n = this.readInt();
-
+
for (let i = 0; i < n; i++) {
let t = this.readByte();
switch (t) {
- case lua.CT.LUA_TNIL:
- f.k.push(new lobject.TValue(lua.CT.LUA_TNIL, null));
+ case defs.CT.LUA_TNIL:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null));
break;
- case lua.CT.LUA_TBOOLEAN:
- f.k.push(new lobject.TValue(lua.CT.LUA_TBOOLEAN, this.readByte()));
+ case defs.CT.LUA_TBOOLEAN:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte()));
break;
- case lua.CT.LUA_TNUMFLT:
- f.k.push(new lobject.TValue(lua.CT.LUA_TNUMFLT, this.readNumber()));
+ case defs.CT.LUA_TNUMFLT:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber()));
break;
- case lua.CT.LUA_TNUMINT:
- f.k.push(new lobject.TValue(lua.CT.LUA_TNUMINT, this.readInteger()));
+ case defs.CT.LUA_TNUMINT:
+ f.k.push(new lobject.TValue(defs.CT.LUA_TNUMINT, this.readInteger()));
break;
- case lua.CT.LUA_TSHRSTR:
- case lua.CT.LUA_TLNGSTR:
+ case defs.CT.LUA_TSHRSTR:
+ case defs.CT.LUA_TLNGSTR:
f.k.push(this.L.l_G.intern(this.read8bitString()));
break;
default:
@@ -205,7 +205,7 @@ class BytecodeParser {
n = this.readInt();
for (let i = 0; i < n; i++) {
f.locvars[i] = {
- varname: new lobject.TValue(lua.CT.LUA_TLNGSTR, lua.to_luastring(this.readString())),
+ varname: new lobject.TValue(defs.CT.LUA_TLNGSTR, defs.to_luastring(this.readString())),
startpc: this.readInt(),
endpc: this.readInt()
};
@@ -234,7 +234,7 @@ class BytecodeParser {
}
checkHeader() {
- if (this.readString(4) !== lua.LUA_SIGNATURE)
+ if (this.readString(4) !== defs.LUA_SIGNATURE)
throw new Error("bad LUA_SIGNATURE, expected '<esc>Lua'");
if (this.readByte() !== 0x53)
@@ -269,8 +269,8 @@ class BytecodeParser {
error(why) {
const lapi = require('./lapi.js');
const ldo = require('./ldo.js');
- lapi.lua_pushstring(this.L, lua.to_luastring(`${this.name}: ${why} precompiled chunk`, true));
- ldo.luaD_throw(this.L, lua.thread_status.LUA_ERRSYNTAX);
+ lapi.lua_pushstring(this.L, defs.to_luastring(`${this.name}: ${why} precompiled chunk`, true));
+ ldo.luaD_throw(this.L, defs.thread_status.LUA_ERRSYNTAX);
}
checksize(byte, size, tname) {