Load
This function loads a Leadwerks map (*.map) file.
Syntax
- bool Load(string path, number flags=LoadScripts)
- bool Load(string path, hook(Entity entity, Object extra), Object extra=NULL, number flags=LoadScripts);
- bool Load(string path, string hookname, Object extra=NULL, number flags=LoadScripts);
Parameters
- path: the file path to load the scene from.
- hook: pointer to a function that will be called for each loaded entity in the scene.
- hookname: script function name that will be called for each loaded entity in the scene.
- flags: optional bitwise flags that may include any of the following:
- Map: Map::LoadScripts: if included, scripts and flowgraph information contained in the map will be loaded.
Returns
Returns true if the scene was successfully loaded, otherwise false is returned.
Example
--Create a window
window = Window:Create()
context = Context:Create(self.window)
world = World:Create()
--Load a map
Map:Load("Maps/start.map")
while true do
if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end
Time:Update()
self.world:Update()
self.world:Render()
self.context:Sync()
return true
end