TextDisplayAddObserver: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function adds a [[player]] as an observer of a [[textdisplay]]. This allows the [[player]] to see any [[textitem]]s that the [[textdisplay]] contains. | This function adds a [[player]] as an observer of a [[textdisplay]]. This allows the [[player]] to see any [[textitem]]s that the [[textdisplay]] contains. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">void textDisplayAddObserver ( textdisplay | <syntaxhighlight lang="lua">void textDisplayAddObserver ( textdisplay display, player playerToAdd )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
* ''' | * '''display''': The [[textdisplay]] to add the [[player]] to as an observer. | ||
* '''playerToAdd ''': The [[player]] that should observe the [[textdisplay]]. | * '''playerToAdd ''': The [[player]] that should observe the [[textdisplay]]. | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua">display = textCreateDisplay () -- create a new display, store the reference in a variable called display | ||
textDisplayAddObserver ( | textDisplayAddObserver ( display, player ) -- add an observer to it | ||
text = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) -- create a text item | |||
textDisplayAddText ( | textDisplayAddText ( display, text ) -- Add the text item to the text display</syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Text Functions}} | {{Text Functions}} |
Revision as of 09:46, 14 August 2006
This function adds a player as an observer of a textdisplay. This allows the player to see any textitems that the textdisplay contains.
Syntax
void textDisplayAddObserver ( textdisplay display, player playerToAdd )
Required Arguments
- display: The textdisplay to add the player to as an observer.
- playerToAdd : The player that should observe the textdisplay.
Example
display = textCreateDisplay () -- create a new display, store the reference in a variable called display textDisplayAddObserver ( display, player ) -- add an observer to it text = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) -- create a text item textDisplayAddText ( display, text ) -- Add the text item to the text display