ref:lua_controller

LuaController

Controller type for use in lua scripting.

The LuaController can be used to control any SCONE Controller that is defined inside the ScriptController. For example, if the ScriptController is defined as follows:

ScriptController {
    script_file = my_script.lua

    ReflexController { name = Reflex1 ... }
    ReflexController { name = Reflex2 ... }
}

The ReflexController instances can now be enabled and disabled in the update function of my_script.lua:

function update( model, time, controller )
    controller:set_child_enabled(1, true) -- enable first ReflexController
    controller:set_child_enabled(2, true) -- disable second ReflexController

    return false -- return true to terminate the simulation early
end
Function Description
LuaString name() get the name of the body
int child_count() number of child controllers
LuaController child(int index) get child controller
void enable(bool enabled) enable controller
bool enabled() check if controller at index is enabled (starting at 1)
void set_child_enabled(int index, bool enabled) enable controller at index (starting at 1)
bool is_child_enabled(int index) check if controller at index is enabled (starting at 1)
int set_control_parameter(LuaString name, LuaNumber value) set the value of a control parameter, returns the number of parameters that were set

Converted from doxygen using dokugen