API:TextLogGetEntry
From RoR Wiki
UI Lua API · TextLog functions
Version: WAR 1.4.8
Returns one entry of a text log.
timestamp, filterType, text = TextLogGetEntry(logName, index)
Arguments
- logName
string– Name of the text log.- index
number– Position of the entry, starting at0for the oldest entry. Cut to a whole number.
Returns
- timestamp
wstring– Local time the entry was added, formatted as[HH:MM:SS].- filterType
number– The entry's filter type.- text
wstring– The entry text, after the<BR>/<P>conversion done by TextLogAddEntry.
Details
- Entries are in the order they were added. When the log is full, the oldest entry is removed, so the entry at a given index changes as new entries arrive.
- A negative index or an index of TextLogGetNumEntries or more raises the Index %d is invalid error and returns nothing.
- The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.
- The stock UI never calls this function.
Errors
Error in function call 'TextLogGetEntry': Text Log %s does not existError in function call 'TextLogGetEntry': Index %d is invalid
Example
A minimal example built from the documented signature:
local count = TextLogGetNumEntries( "Chat" )
if count > 0 then
local timestamp, filterType, text = TextLogGetEntry( "Chat", count - 1 ) -- newest entry
end
