crystal.ScriptSystem

This ECS System powers Behavior and ScriptRunner components.

Methods

Name Description
run_scripts Runs all scripts owned by ScriptRunner components.

Examples

local ecs = crystal.ECS:new();
local script_system = ecs:add_system(crystal.ScriptSystem);

local entity = ecs:spawn(crystal.Entity);
entity:add_component(crystal.ScriptRunner);
entity:add_script(function(self)
  print("Oink");
end);

-- In your scene's update function:
ecs:update();
script_system:run_scripts(); -- prints Oink

This site uses Just the Docs, a documentation theme for Jekyll.