Scripting a System

Creating a system is similar to creating components through Lua.

Like components, a script for a system MUST have an Initialize and Update function. Additionally, the Update function can take a dt parameter.

Here is the basic template for a system: function Initialize print("Initializing the system.") end function Update(dt) print("Updating the system.") end

When creating a system through Lua, you usually want variables on the system. This can be done through the use of the global table. You can access the global table through the _G keyword.

Here is an example: --Creating a new global table and counter _G.SystemListTable = {} _G.SystemCounter = 0

That's the basics of creating a system! See Scripting a Class and Creating the ActionList System for more details.