mirror of
https://github.com/kikito/beholder.lua.git
synced 2024-12-16 00:34:21 +00:00
fixed README
This commit is contained in:
parent
e9a3d1a113
commit
d66b78dd8b
@ -86,17 +86,17 @@ Will trigger this action:
|
||||
|
||||
But also this other one:
|
||||
|
||||
<pre>Beholder:trigger({'PLAYERDETECTION', player1}, function(x,y) print("player1 detected at ",x,y)</pre>
|
||||
<pre>Beholder:observe({'PLAYERDETECTION', player1}, function(x,y) print("player1 detected at ",x,y)</pre>
|
||||
|
||||
Notice that the two "missing elements" of the table will be passed to the callback as additional parameters. Indeed, that second d action will be executed any time player1 is detected, no matter what coordinates.
|
||||
|
||||
Similarly, you can add an action that will be triggered for any player detection:
|
||||
|
||||
<pre>Beholder:trigger({'PLAYERDETECTION'}, function(player,x,y) print(player.no," detected at ",x,y)</pre>
|
||||
<pre>Beholder:observe({'PLAYERDETECTION'}, function(player,x,y) print(player.no," detected at ",x,y)</pre>
|
||||
|
||||
As a matter of fact, that code would be exactly equivalent to this other code:
|
||||
|
||||
<pre>Beholder:trigger('PLAYERDETECTION', function(player,x,y) print(player.no," detected at ",x,y)</pre>
|
||||
<pre>Beholder:observe('PLAYERDETECTION', function(player,x,y) print(player.no," detected at ",x,y)</pre>
|
||||
|
||||
If you want to detect all signals raised (i.e. for logging and debugging) you can do so by observing the empty table:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user