# Method Global:CreateLuaEvent [-] [+]

Registers a global timed event.

When the passed function is called, the parameters `(eventId, delay, repeats)` are passed to it.

Repeats will decrease on each call if the event does not repeat indefinitely

## Synopsis

`eventId = CreateLuaEvent( function, delay )`

`eventId = CreateLuaEvent( function, delaytable )`

`eventId = CreateLuaEvent( function, delay, repeats )`

`eventId = CreateLuaEvent( function, delaytable, repeats )`

## Arguments

`function function`

  Function to trigger when the time has passed.

`number delay`

  Set time in milliseconds for the event to trigger.

  Valid numbers: integers from 0 to 4,294,967,295.

`table delaytable`

  A table `{min, max}` containing the minimum and maximum delay time.

`number repeats (1)`

  How many times for the event to repeat, 0 is infinite.

  Valid numbers: integers from 0 to 4,294,967,295.

## Returns

`number eventId`

  Unique ID for the timed event used to cancel it or nil.

  Valid numbers: integers from -2,147,483,647 to 2,147,483,647.

# Keyboard shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

# Search tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct` (or `str`), `enum`, `trait`, `typedef` (or `tdef`).

Generated on
© 2010 - 2024 Eluna Lua Engine