sm.event
Events for communicating between scripts by running callbacks.
Functions
sendToCharacter
sm.event.sendToCharacter( character, callback, data )
Sends an event to the specified Character's script.
The callback function is executed in the next Lua tick.
character[ Character ]: The character.callback[ string ]: The name of the callback function in the character script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToGame
sm.event.sendToGame( callback, data )
Sends an event to the game script.
The callback function is executed in the next Lua tick.
callback[ string ]: The name of the callback function in the game script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToHarvestable
sm.event.sendToHarvestable( harvestable, callback, data )
Sends an event to the specified harvestable's script.
The callback function is executed in the next Lua tick.
harvestable[ Harvestable ]: The harvestable.callback[ string ]: The name of the callback function in the harvestable script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToInteractable
sm.event.sendToInteractable( interactable, callback, data )
Sends an event to the specified interactable's script.
The callback function is executed in the next Lua tick.
interactable[ Interactable ]: The interactable.callback[ string ]: The name of the callback function in the interactable script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToPlayer
sm.event.sendToPlayer( player, callback, data )
Sends an event to the specified player's script.
The callback function is executed in the next Lua tick.
player[ Player ]: The player.callback[ string ]: The name of the callback function in the player script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToScriptableObject
sm.event.sendToScriptableObject( scriptableObject, callback, data )
Sends an event to the specified scriptableObject's script.
The callback function is executed in the next Lua tick.
scriptableObject[ ScriptableObject ]: The scriptable object.callback[ string ]: The name of the callback function in the scriptableObject's script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToTool
sm.event.sendToTool( tool, callback, data )
Sends an event to the specified tool's script.
The callback function is executed in the next Lua tick.
tool[ Tool ]: The tool.callback[ string ]: The name of the callback function in the tool script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToUnit
sm.event.sendToUnit( unit, callback, data )
Sends an event to the specified unit's script.
The callback function is executed in the next Lua tick.
unit[ Unit ]: The unit.callback[ string ]: The name of the callback function in the unit script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.
sendToWorld
sm.event.sendToWorld( world, callback, data )
Sends an event to the specified world's script.
The callback function is executed in the next Lua tick.
world[ World ]: The world.callback[ string ]: The name of the callback function in the world script.data[ any ]: Extra data to send to the callback function.
- [ bool ]: Whether the callback function was found or not.