TextDisplayGetObservers: Difference between revisions
Jump to navigation
Jump to search
(not complete yet) |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
This function can be used to retrieve all the [[player]]s currently observing a specified [[textdisplay]]. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua">table textDisplayGetObservers ( textdisplay theDisplay )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
* '''theDisplay''': The [[textdisplay]] of which observers you want to get. | |||
===Returns=== | ===Returns=== | ||
Returns a [[table]] of players that are observers of the display or ''false'' if invalid textdisplay is passed. | |||
==Example== | |||
<syntaxhighlight lang="lua"> | |||
function removeAllObservers ( player , command ) | |||
local tObservers = textDisplayGetObservers ( serverDisplay ) -- get a table of all observers in 'serverDisplay' text display | |||
if tObservers then -- if got the table | |||
for index,player in ipairs ( tObservers ) do -- loop the table | |||
textDisplayRemoveObserver ( serverDisplay , player ) -- remove the player from the text display | |||
end | |||
end | |||
end | |||
addCommandHandler("removeAllObservers",removeAllObservers) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Text functions}} | {{Text functions}} | ||
Latest revision as of 15:29, 22 May 2012
This function can be used to retrieve all the players currently observing a specified textdisplay.
Syntax
table textDisplayGetObservers ( textdisplay theDisplay )
Required Arguments
- theDisplay: The textdisplay of which observers you want to get.
Returns
Returns a table of players that are observers of the display or false if invalid textdisplay is passed.
Example
function removeAllObservers ( player , command ) local tObservers = textDisplayGetObservers ( serverDisplay ) -- get a table of all observers in 'serverDisplay' text display if tObservers then -- if got the table for index,player in ipairs ( tObservers ) do -- loop the table textDisplayRemoveObserver ( serverDisplay , player ) -- remove the player from the text display end end end addCommandHandler("removeAllObservers",removeAllObservers)
See Also
- textCreateDisplay
- textCreateTextItem
- textDestroyDisplay
- textDestroyTextItem
- textDisplayAddObserver
- textDisplayAddText
- textDisplayGetObservers
- textDisplayIsObserver
- textDisplayRemoveObserver
- textDisplayRemoveText
- textItemGetColor
- textItemGetPosition
- textItemGetPriority
- textItemGetScale
- textItemGetText
- textItemSetColor
- textItemSetPosition
- textItemSetPriority
- textItemSetScale
- textItemSetText