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:

    TypeNameDescription
    CharactercharacterThe character.
    stringcallbackThe function name in a character script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToGame(callback, args=nil)

    Sends an event to the game script.

    Parameters:

    TypeNameDescription
    stringcallbackThe function name in the game script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToHarvestable(harvestable, callback, args=nil)

    Sends an event to a specified Harvestable.

    Parameters:

    TypeNameDescription
    HarvestableharvestableThe harvestable.
    stringcallbackThe function name in a harvestable script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToInteractable(interactable, callback, args=nil)

    Sends an event to a specified Interactable.

    Parameters:

    TypeNameDescription
    InteractableinteractableThe interactable.
    stringcallbackThe function name in a interactable script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToPlayer(player, callback, args=nil)

    Sends an event to a specified Player.

    Parameters:

    TypeNameDescription
    PlayerplayerThe player.
    stringcallbackThe function name in a player script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToScriptableObject(scriptableObject, callback, args=nil)

    Sends an event to a specified ScriptableObject.

    Parameters:

    TypeNameDescription
    ScriptableObjectscriptableObjectThe scriptableObject.
    stringcallbackThe function name in a scriptableObject script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToTool(tool, callback, args=nil)

    Sends an event to a specified Tool.

    Parameters:

    TypeNameDescription
    TooltoolThe tool.
    stringcallbackThe function name in a tool script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToUnit(unit, callback, args=nil)

    Sends an event to a specified Unit.

    Parameters:

    TypeNameDescription
    UnitunitThe unit.
    stringcallbackThe function name in a unit script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.

    sm.event.sendToWorld(world, callback, args=nil)

    Sends an event to a specified World.

    Parameters:

    TypeNameDescription
    WorldworldThe world.
    stringcallbackThe function name in a world script.
    anyargs=nilOptional arguments to be sent to the callback.

    Returns:

    TypeDescription
    booleanresult Returns true if the callback was found.