Repository navigation
luaManagerAPI
#Manager
The manager table is what controls everything relating to the program as a whole.
In general, use of this class should be avoided in systems when not needed.
A manager instance is available in every file as the global variable manager.
##API
(table)component = manager:get_component((int)entity_id, (string)component_name)
Used to get a component from an entity_id. This function will return nil if there is no entity matching entity_id.
It returns a component in the form of { attribute = 0, color = Vec3f(1,2,3) }
manager:pause()
Pauses all user systems until resume is called.
manager:resume()
Reloads the main.lua file as well as all lua systems and resumes or restarts the game. This function tries to keep the current game state where the user left off. If there where big changes in main.lua it will reload from the start of the game.
(table)entities = manager:get_all_entities()
Gets a table consisting of every entity. This table is the entire game state.
Changes in this table do not propagate into the game without calling manager:update_all_entities(entities).
This table is in the form of:
{
{ -- entity 1
Component1 = { a = 2, b = 2},
Component2 = { a = 6, moo = "cow" },
},
{ -- entity 2
Transform = {pos = Vec3f(1, 2, 3) }
}
}
manager:update_all_entities((table)entities)
Takes an entity table and propagates it into the game. This function is used internally when pausing and resuming the game.