LLEvents.on

LLEvents.on

Method for hooking event by name

Example

local handler = function(arg: { DetectedEvent }) : ()
  -- Your code
end

LLEvents:on("collision", handler)
Raw function spec json
{
  "def": "func",
  "name": "on",
  "energy": 0,
  "must_use": false,
  "sleep": 0,
  "signatures": [
    {
      "def": "signature",
      "result": [
        {
          "name": "",
          "def": "result",
          "desc": "",
          "variadic": false,
          "type": [
            {
              "def": "custom",
              "value": "EventHandler"
            }
          ],
          "optional": false
        }
      ],
      "args": [
        {
          "def": "arg",
          "name": "self",
          "desc": "self",
          "type": [
            {
              "def": "custom",
              "value": "LLEventsProto"
            }
          ],
          "variadic": false,
          "optional": false
        },
        {
          "def": "arg",
          "name": "eventName",
          "desc": "name of the Event to hook",
          "type": [
            {
              "def": "custom",
              "value": "DetectedEventName"
            }
          ],
          "variadic": false,
          "optional": false
        },
        {
          "def": "arg",
          "name": "handler",
          "desc": "The name of the function to handle the event",
          "type": [
            {
              "def": "custom",
              "value": "DetectedEventHandler"
            }
          ],
          "variadic": false,
          "optional": false
        }
      ]
    },
    {
      "def": "signature",
      "result": [
        {
          "name": "",
          "def": "result",
          "desc": "",
          "variadic": false,
          "type": [
            {
              "def": "custom",
              "value": "EventHandler"
            }
          ],
          "optional": false
        }
      ],
      "args": [
        {
          "def": "arg",
          "name": "self",
          "desc": "self",
          "type": [
            {
              "def": "custom",
              "value": "LLEventsProto"
            }
          ],
          "variadic": false,
          "optional": false
        },
        {
          "def": "arg",
          "name": "eventName",
          "desc": "name of the Event to hook",
          "type": [
            {
              "def": "custom",
              "value": "NonDetectedEventName"
            }
          ],
          "variadic": false,
          "optional": false
        },
        {
          "def": "arg",
          "name": "handler",
          "desc": "The name of the function to handle the event",
          "type": [
            {
              "def": "custom",
              "value": "EventHandler"
            }
          ],
          "variadic": false,
          "optional": false
        }
      ]
    }
  ],
  "desc": "Method for hooking event by name",
  "link": null,
  "takesSelf": true,
  "private": false
}

< Back to LLEvents