adray / SunScript

Simple, embeddable and lightweight scripting virtual machine.
MIT License
0 stars 0 forks source link

Pop discard #3

Closed adray closed 2 weeks ago

adray commented 3 months ago

Pop discard instruction isn't a nice solution, additionally SunScript doesn't seem to handle passing return value into another function in all cases.

adray commented 3 months ago

Pop discard errorously pops the 5 which is pushed as part of the + 5

var foo = -10;
Print(foo);
function Test1() {
    Print("Test");
    return 5;
}
function Test2(x) {
    Print("Foo: " + x);
}
var x = 2 + Test1();
Print(x);
Test2(Test1() + 5);