Difference between revisions of "Category:Lua Callbacks"
From Fortress Forever Wiki
Jump to navigationJump to searchm |
m |
||
| (One intermediate revision by the same user not shown) | |||
| Line 4: | Line 4: | ||
Access to events is typically in the following format: | Access to events is typically in the following format: | ||
| − | function '' | + | ''item'' = '''entity''':new({ |
| + | data0 = 0, | ||
| + | data1 = 0, | ||
| + | }) | ||
| + | |||
| + | function ''item'':'''eventname'''( ''parameters'' ) | ||
--What to do when this method is called | --What to do when this method is called | ||
--return anything, if necessary | --return anything, if necessary | ||
Latest revision as of 09:43, 5 June 2011
|
Callbacks are user-defined functions which are activated by events in the game. The lua script can change the outcome of these events, or simply use the event as a cue to run some other code. Access to events is typically in the following format: item = entity:new({
data0 = 0,
data1 = 0,
})
function item:eventname( parameters )
--What to do when this method is called
--return anything, if necessary
end
Different methods may provide data by passing on a number of parameters. The types of these parameters, returned values and examples of usage can be found on their respective pages. Entity OutputsThe lua system can catch any entity output from [Source's I/O system] and run lua code. For example, func_breakable:onbreak() can be used to detect when an item breaks. |
Pages in category "Lua Callbacks"
The following 18 pages are in this category, out of 18 total.