Im newbie gideros user. It seems that gideros loads automatically lua files in the project before running main.lua. Can i control the loading sequence? For example, i want to import a.lua after b.lua is imported.
Sure, just right click the a.lua file in gideros studio and select ‘dependency’. From there you can select the b.lua file as being needed by a.lua, and gideros will ensure b.lua is loaded first. There is also two files names which have specific rules: - init.lua is always loaded first - main.lua is always loaded last
@MoKaLux, if you do that, lua engine will try to load a.lua while parsing b.lua, but Gideros will still load it too sooner or later, so a.lua will have been parsed/executed twice. This can be problematic if you initialize stuff in it. Anyway it won't work if you export the project, since gideros will merge all lua files into a single one so a.lua will no longer exist on the exported project. Unless you mark it as 'exclude from execution', in which case gideros will leave it aside and won't try to load it by itself.
I think "Then we have files in alphabetical order (upper case first, then lowercase), while resolving code dependencies provided." may be incorrect. I don't think there is any particular order unless you specify something needs to be loaded before something else.
(with the exception of init.lua and main.lua)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
it's not from me There was another post but I couldn't find it where the person specified folders order as well. If anyone can find it that would be cool so I (or he/she) can update the wiki.
@SinisterSoft I am not sure if the sentence makes sense in english, I just kind of copy pasted. Can you correct it for me here so I can change it in the wiki please?
@hgy29 will know for sure, but I thought it was not pre-sorted alphabetically - so possibly in whatever order they were in the project file.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I guess the loading is performed by ASCII code order because files that has special character are loaded first. For example !a.lua is read before a.lua. It seems that this is applied to the folders.
Comments
There is also two files names which have specific rules:
- init.lua is always loaded first
- main.lua is always loaded last
Likes: SinisterSoft
Anyway it won't work if you export the project, since gideros will merge all lua files into a single one so a.lua will no longer exist on the exported project. Unless you mark it as 'exclude from execution', in which case gideros will leave it aside and won't try to load it by itself.
Likes: SinisterSoft, MoKaLux
has just been updated
Likes: SinisterSoft
(with the exception of init.lua and main.lua)
https://deluxepixel.com
it's not from me There was another post but I couldn't find it where the person specified folders order as well. If anyone can find it that would be cool so I (or he/she) can update the wiki.
@SinisterSoft I am not sure if the sentence makes sense in english, I just kind of copy pasted. Can you correct it for me here so I can change it in the wiki please?
https://deluxepixel.com
Likes: MoKaLux