Page 1 of 1

Where to put global variables?

Posted: Wed Nov 16, 2011 4:54 pm
by Gambit37
I've put some file path variables in my startup.lua so that I can use them anywhere to reference my resources folders, eg:

Code: Select all

pathimg = "../../../project/_rtc/_files/_img/"
pathsfx = "../../../project/_rtc/_files/_sfx/"
pathmus = "../../../project/_rtc/_files/_mus/"
However, now ESB complains when I open the dungeon file that these variables are empty:

Code: Select all

attempt to concatenate global 'pathimg' (a nil value)
How and where should I declare global variables like this so they work in both DSB and ESB?

Re: Where to put global variables?

Posted: Wed Nov 16, 2011 8:34 pm
by Sophia
This should work. Something else must be going wrong.

Which file are you trying to use the paths in, and where?
Can you paste the code that tries to do it?

Re: Where to put global variables?

Posted: Wed Nov 16, 2011 9:06 pm
by Gambit37
I have a small lua file to code up an orc, called orc.lua which is read in my objects.lua with dsb_import_arch("orc.lua", "orc"). This is what DSB chokes on --it's fine if I also add my path variables to the orc.lua file though, but that rather defeats the point of globals... ;-)

Re: Where to put global variables?

Posted: Wed Nov 16, 2011 9:39 pm
by Sophia
Ok, I'll fix that.