KelvinShadewing / brux-gdk

Free runtime and development kit using SDL and Squirrel
GNU Affero General Public License v3.0
40 stars 20 forks source link

Running another nut from in test.nut fails #23

Open KelvinShadewing opened 4 years ago

KelvinShadewing commented 4 years ago

When running the program by itself so that it loads /rte/bin/test.nut, the menu seems to work perfectly fine, and even lets me navigate directories like it should. However, if I select another nut to run, I get this weird error. The following is what I got trying to run /test/my.nut:

AN ERROR HAS OCCURED [indexing string with string]

CALLSTACK

*FUNCTION [unknown()] /home/kelvin/Code/brux/test/src/main.nut line [5]

*FUNCTION [main()] /home/kelvin/Code/brux/test/my.nut line [7]

*FUNCTION [unknown()] NATIVE line [-1]

*FUNCTION [unknown()] test.nut line [92]

*FUNCTION [main()] test.nut line [246]

LOCALS

[this] "my.nut"

[vargv] ARRAY

[this] "my.nut"

[this] TABLE

[brxQuit] false

[vargv] ARRAY

[this] TABLE

I tried navigating out of Brux's project folder and into Fly Little Dragon's, and upon running that, got a similar error:

AN ERROR HAS OCCURED [trying to set 'string']

CALLSTACK

*FUNCTION [unknown()] /home/kelvin/Code/fld/src/main.nut line [6]

*FUNCTION [main()] /home/kelvin/Code/fld/fld.nut line [28]

*FUNCTION [unknown()] NATIVE line [-1]

*FUNCTION [unknown()] test.nut line [91]

*FUNCTION [main()] test.nut line [245]

LOCALS

[this] "fld.nut"

[vargv] ARRAY

[this] "fld.nut"

[this] TABLE

[brxQuit] false

[vargv] ARRAY

[this] TABLE

What's weird is it got as far as changing the window size and title when I ran it, so it's executing something.

However, if I launch Brux directly from these games' respective directories, they run perfectly fine, so the issue is with the test app somehow. I need to figure out how to make this work, not just so the runtime can have a built-in menu for handheld devices, but so that other games don't have to face the same issue when trying to run mods.

KelvinShadewing commented 4 years ago

OK, so in <project folder>/test/my.nut, it seems to be pointing to a line that contains quit = 0 which gives [trying to set 'string']. If I change = to <-, it becomes [indexing string with string]. It isn't being set to a string anywhere I can see, nor is it being used to index anything.

RizzoRat commented 4 years ago

in all cases when this happened to me with squirrel, there was an object shadowing the object I meant, like a local. However, from the fact that a slot operator throws "indexing string with string" I'd recommend analysing the this-object. It could be a string instead of a table for some reason (stack issues maybe). To do a quick test, "foobar<-0" would throw the same error in that case. Same applies for bindenv, maybe a string is bound to the function...