# HG changeset patch # User Matthew Wild # Date 1270484598 -3600 # Node ID 418fd175eaeddf2ec454b6082c7eb6de461e35a9 # Parent c5c9c4f2d1d3364d3fd68651afbd82125f2f6e03 Implement OP_SETGLOBAL diff -r c5c9c4f2d1d3 -r 418fd175eaed lvm.js --- 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;