Implement OP_LOADBOOL

Sun, 23 May 2010 17:31:41 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 23 May 2010 17:31:41 +0100
changeset 39
53d5bf6654ba
parent 38
ba347b4b655f
child 40
3a074ec1790f

Implement OP_LOADBOOL

lvm.js file | annotate | diff | comparison | revisions
--- a/lvm.js	Sun May 23 17:31:15 2010 +0100
+++ b/lvm.js	Sun May 23 17:31:41 2010 +0100
@@ -1,6 +1,7 @@
 
 var OP_MOVE = 0;
 var OP_LOADK = 1;
+var OP_LOADBOOL = 2;
 var OP_LOADNIL = 3;
 var OP_GETUPVAL = 4;
 var OP_GETGLOBAL = 5;
@@ -300,6 +301,11 @@
 				for(var i = INS_A(instruction);i<=INS_B(instruction);i++)
 					this.frame.reg[i] = new LValue("nil", null);
 				break;
+			case OP_LOADBOOL:
+				this.frame.reg[INS_A(instruction)] = new LValue("boolean", INS_B(instruction)!=0);
+				if(INS_C(instruction)!=0)
+					this.frame.pc++;
+				break;
 			case OP_GETUPVAL:
 				this.frame.reg[INS_A(instruction)] = this.frame.f.upvalues[INS_B(instruction)];
 				break;

mercurial