sm.event
Events for communicating between scripts by running callbacks.
Functions:
sendToCharacter sendToGame sendToHarvestable sendToInteractable sendToPlayer sendToScriptableObject sendToTool sendToUnit sendToWorld
sm.event.sendToCharacter(character, callback, args=nil)
Sends an event to a specified Character.
Parameters:
| Type | Name | Description |
| Character | character | The character. |
| string | callback | The function name in a character script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToGame(callback, args=nil)
Sends an event to the game script.
Parameters:
| Type | Name | Description |
| string | callback | The function name in the game script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToHarvestable(harvestable, callback, args=nil)
Sends an event to a specified Harvestable.
Parameters:
| Type | Name | Description |
| Harvestable | harvestable | The harvestable. |
| string | callback | The function name in a harvestable script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToInteractable(interactable, callback, args=nil)
Sends an event to a specified Interactable.
Parameters:
| Type | Name | Description |
| Interactable | interactable | The interactable. |
| string | callback | The function name in a interactable script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToPlayer(player, callback, args=nil)
Sends an event to a specified Player.
Parameters:
| Type | Name | Description |
| Player | player | The player. |
| string | callback | The function name in a player script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToScriptableObject(scriptableObject, callback, args=nil)
Sends an event to a specified ScriptableObject.
Parameters:
| Type | Name | Description |
| ScriptableObject | scriptableObject | The scriptableObject. |
| string | callback | The function name in a scriptableObject script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToTool(tool, callback, args=nil)
Sends an event to a specified Tool.
Parameters:
| Type | Name | Description |
| Tool | tool | The tool. |
| string | callback | The function name in a tool script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToUnit(unit, callback, args=nil)
Sends an event to a specified Unit.
Parameters:
| Type | Name | Description |
| Unit | unit | The unit. |
| string | callback | The function name in a unit script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |
sm.event.sendToWorld(world, callback, args=nil)
Sends an event to a specified World.
Parameters:
| Type | Name | Description |
| World | world | The world. |
| string | callback | The function name in a world script. |
| any | args=nil | Optional arguments to be sent to the callback. |
Returns:
| Type | Description |
| boolean | result Returns true if the callback was found. |