TextDisplayGetObservers: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 13: | Line 13: | ||
==Example== | ==Example== | ||
<section name="Server" class=" | <section name="Server" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | |||
function removeAllObservers ( player , command ) | |||
local tObservers = textDisplayGetObservers ( serverDisplay ) -- get a table of all observers in 'serverDisplay' text display | |||
if tObservers then | |||
for index,player in ipairs ( tObservers ) do | |||
textDisplayRemoveObserver ( serverDisplay , player ) | |||
end | |||
end | |||
end | |||
addCommandHandler("removeAllObservers",removeAllObservers) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 10:23, 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
Click to collapse [-]
Serverfunction removeAllObservers ( player , command ) local tObservers = textDisplayGetObservers ( serverDisplay ) -- get a table of all observers in 'serverDisplay' text display if tObservers then for index,player in ipairs ( tObservers ) do textDisplayRemoveObserver ( serverDisplay , player ) 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