TextItemGetText: Difference between revisions
Jump to navigation
Jump to search
JonChappell (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | |||
This function returns the current text of the specified [[textitem]]. | This function returns the current text of the specified [[textitem]]. | ||
Line 14: | Line 15: | ||
==Example== | ==Example== | ||
Increment a score display. In real scripts it's of course better to just keep a 'score' variable and only use [[textItemSetText]]. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function givePoint ( player ) | |||
local textitem = scoretextitems[player] | |||
local score = textItemGetText ( textitem ) | |||
score = tostring(tonumber(score) + 1) | |||
textItemSetText ( textitem, score ) | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 17:47, 15 August 2007
This function returns the current text of the specified textitem.
Syntax
string textItemGetText ( textitem theTextitem )
Required Arguments
- theTextitem: A valid textitem.
Returns
Returns a string containing the text if the function was successful, false otherwise.
Example
Increment a score display. In real scripts it's of course better to just keep a 'score' variable and only use textItemSetText.
function givePoint ( player ) local textitem = scoretextitems[player] local score = textItemGetText ( textitem ) score = tostring(tonumber(score) + 1) textItemSetText ( textitem, score ) end
See Also
- textCreateDisplay
- textCreateTextItem
- textDestroyDisplay
- textDestroyTextItem
- textDisplayAddObserver
- textDisplayAddText
- textDisplayGetObservers
- textDisplayIsObserver
- textDisplayRemoveObserver
- textDisplayRemoveText
- textItemGetColor
- textItemGetPosition
- textItemGetPriority
- textItemGetScale
- textItemGetText
- textItemSetColor
- textItemSetPosition
- textItemSetPriority
- textItemSetScale
- textItemSetText