I'm not sure whether this is a question or a statement of fact but I've found that, if I create a module with the standard declaration:
module(..., package.seeall)
and just include the file in a project, then I get an error when trying a run:
"bad argument #1 to 'module' (string expected, got nil)"
I guess this is because Gideros, by default, loads all files at the beginning of a run and so no parameter name is being transferred to the module declaration. The solution appears to be to right click on the module file in the IDE and choose "Exclude from Execution" so that Gideros doesn't automatically run the file. Then accessing the module using require "modulename" works as normal.
Is this expected behaviour when using modules with Gideros? I'm sorry if this is an obvious question but I don't tend to use modules much - having switched almost entirely over to using Gideros classes.
Best regards
Comments
module("...", package.seeall)
or ... is kind of internal constant?
http://lua-users.org/wiki/ModulesTutorial
I think they just use the ellipsis to avoid having to retype the actual module name.
Best regards
Although I don't know modules much, excluding the file is the correct way.
---------------------------------------
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
For example if in your app, you've 60 or more files of tilemaps (they are only tables) exclude them from execution can improve "watchdog timer" (iPhone, iPad) but I don't know if it can affect performance the app because these levels (tables) not have been previously loaded. (The real problem is restart the same level and load again the same table)
Although on the other hand, it's unlikely that a user can play 60 or more levels at once.
But any suggestion thanks.
P.S. each level file Tilemap.lua has 1000 lines... in total it should be 60000 lines or more.
[-] Liasoft
@OZApps, @ar2rsawseen or somebody more
Thanks
[-] Liasoft
What I did in Mashballs, was creating separate files for each level, and then upon starting a level, I loaded the specific level definition file. The files were not lua, so they were not executed automatically, and I had to read the contents using io, thus the contents were only stored in the memory, while parsing it and interpreting it/ generating level and then got rid of it.
And it seems to work great
Actually I'm tweaking the code so I have excluded files levelTilemap.lua, but these are loaded... on the other hand files types json, *. otf or *. txt can't be excluded of project.
I guess despite levelTilemap.lua were excluded files as these have a direct dependence on the creator of levels Class, they will be loaded (please correct me if I'm wrong) but excluding other *. Lua unrelated to anything for example testMen.lua (it's a class) when I run the code first time Gideros Player with Mac doesn't load.
Furthermore, if I'll use levelTilemap.txt (it can't be excluded)... hmm issue is that the data are tabulated and there are variables with data and extract the information in that form would be a big headache.
[-] Liasoft
lua files are executed/ran by default, running everything that is inside, if lua file is excluded it is not ran, until required in some other file using require command.
Basically, it seems that tilemaps are not your problem with watchdog timer, but something else, possible large graphic files
Thanks again >-
[-] Liasoft