nanos world API Reference Unofficial documentation
Function Shared Fast

Entity:Subscribe

Subscribes to an <a href='/docs/core-concepts/scripting/events-guide'>Event</a> on this specific entity

Syntax

Lua
my_entity:Subscribe(event_name, callback)

Parameters

Name Type Default Description
event_name string Name of the event to subscribe to
callback function Function to call when the event is triggered

Returns

  • function Callback that was passed (useful for unsubscribing later if your callback is an anonymous function)