Instantiate a new LValue in OP_LOADK, otherwise "constants" aren't so constant...

Sun, 23 May 2010 13:28:23 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 23 May 2010 13:28:23 +0100
changeset 33
6cc1b0a8dd97
parent 32
035aacc192d8
child 34
2c3d73c76d0f

Instantiate a new LValue in OP_LOADK, otherwise "constants" aren't so constant...

lvm.js file | annotate | diff | comparison | revisions
--- a/lvm.js	Sun May 23 13:27:36 2010 +0100
+++ b/lvm.js	Sun May 23 13:28:23 2010 +0100
@@ -313,8 +313,8 @@
 				this.frame.f.environment.setIndex(name, this.frame.reg[instruction[1]]);
 				break;
 			case OP_LOADK:
-				var value = this.frame.f.constants[INS_Bx(instruction)];
-				this.frame.reg[INS_A(instruction)] = value;
+				var constant = this.frame.f.constants[INS_Bx(instruction)];
+				this.frame.reg[INS_A(instruction)] = new LValue(constant.type, constant.value);
 				break;
 			case OP_NEWTABLE:
 				this.frame.reg[INS_A(instruction)] = new LValue("table", {});

mercurial