489 var args; |
489 var args; |
490 if(B != 1) |
490 if(B != 1) |
491 args = frame.reg.slice(A+1, B==0?undefined:(A+B)); |
491 args = frame.reg.slice(A+1, B==0?undefined:(A+B)); |
492 else |
492 else |
493 args = []; |
493 args = []; |
494 for(var i=args.length;i<f.maxStackSize;i++) |
494 if(B != 0) |
495 args[i] = new LValue(this, "nil", null); |
495 frame.reg.length = A+B; |
496 if(typeof(f) == "function") |
496 if(typeof(f) == "function") |
497 { |
497 { |
498 // JS native function |
498 // JS native function |
499 var ret = this.call(f, args); |
499 var ret = this.call(f, args); |
500 // Insert ret to reg starting at R(A), with C-1 limit |
500 // Insert ret to reg starting at R(A), with C-1 limit |
517 break; |
517 break; |
518 } |
518 } |
519 } |
519 } |
520 else |
520 else |
521 { |
521 { |
|
522 if(args.length > f.numParameters) |
|
523 args.length = f.numParameters; |
|
524 for(var i=args.length;i<f.maxStackSize;i++) |
|
525 args[i] = new LValue(this, "nil", null); |
522 // Lua function |
526 // Lua function |
523 frame = {f:f,pc:0,reg:args, |
527 frame = {f:f,pc:0,reg:args, |
524 retAt:INS_A(instruction),retCount:INS_C(instruction), |
528 retAt:INS_A(instruction),retCount:INS_C(instruction), |
525 entry:false}; |
529 entry:false}; |
526 this.callstack.push(frame); |
530 this.callstack.push(frame); |