Mon, 05 Apr 2010 17:23:18 +0100
Implement OP_SETGLOBAL
lvm.js | file | annotate | diff | comparison | revisions |
--- a/lvm.js Mon Apr 05 17:14:58 2010 +0100 +++ b/lvm.js Mon Apr 05 17:23:18 2010 +0100 @@ -3,6 +3,7 @@ var OP_LOADK = 1; var OP_LOADNIL = 3; var OP_GETGLOBAL = 5; +var OP_SETGLOBAL = 7; var OP_CALL = 28; var OP_RETURN = 30; @@ -107,6 +108,10 @@ var name = this.frame.f.constants[instruction[2]]; this.frame.reg[instruction[1]] = this.frame.f.environment.index(name); break; + case OP_SETGLOBAL: + var name = this.frame.f.constants[instruction[2]]; + this.frame.f.environment.setIndex(name, this.frame.reg[instruction[1]]); + break; case OP_LOADK: var value = this.frame.f.constants[instruction[2]]; this.frame.reg[instruction[1]] = value;