I came across a little problem with Map:Load on a big map with lots of dependencies (entities, sounds, textures, ...).
Though it works fine and everything it has one problem:
While loading the engine does not care for the event loop, causing the operating system to mark the process as not responding.
If you know what's going on, this is no problem. But it may be confusing to later customers that might become nervous that the game just crashed. Even if you know why the game freezes during the loading of the map you cannot exactly be sure if it is still loading or if it crashed.
I found in the documentation that there is an overload of Map:Load allowing to provide a hook that is called for each loaded instance: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/map/mapload-r510
Here my problem is: there is no example on how to use this method from LUA (as for now I only got the Indie version as a backer).
I tried doing something like
Map:Load("path to map", "onEntitiyLoaded");
But I am not sure on how to give self to that function so it can call e.g. self.World:Update() and stuff...
also what I tried just made the game crash....
So there are 2 solutions I can think of:
Doing the load in an extra thread which signals when it's done, so the main thread can just run the main loop and maybe show some art or a progress bar or what not.
Or the load should be reentrant, so you can do the main loop and on each iteration you go on loading a bit more of the map.