603 break; |
603 break; |
604 default: |
604 default: |
605 throw "Unhandled opcode: "+INS_OPCODE(instruction); |
605 throw "Unhandled opcode: "+INS_OPCODE(instruction); |
606 } |
606 } |
607 } |
607 } |
|
608 }, |
|
609 registerLib: function (env, name, lib) |
|
610 { |
|
611 var t; |
|
612 if(name) |
|
613 { |
|
614 t = this.LValue({}); // Create env[name] and put fns in there |
|
615 env.setIndex(this.LValue(name), t); |
|
616 } |
|
617 else |
|
618 t = env; // Import directly into env |
|
619 |
|
620 for(var k in lib) |
|
621 t.setIndex(this.LValue(k), this.LValue(lib[k])); |
608 } |
622 } |
609 }; |
623 }; |
610 |
624 |
611 try{ |
625 try{ |
612 var testvm = new LVM(); |
626 var testvm = new LVM(); |