Journal.refresh
From OpenEUO
Revision as of 18:53, 8 January 2011 by Ximan (Talk | contribs) (Created page with "== Calling Pattern == Call local j = sl.journal() later local a,b,c = j.refresh() Results a is a number, the number of new lines since last refresh b is a number, the total n...")
Calling Pattern
Call
local j = sl.journal()
later
local a,b,c = j.refresh()
Results
a is a number, the number of new lines since last refresh b is a number, the total number of lines in the journal c is a number, the number of lines unread since last mark or nextline call
Example
local j = sl.journal() local e,line,col,name = "","",0,"" local start,color = 3,946 while true do local new,total,unread = j.refresh() if unread > 0 then line = "" local tot,ur = j.count() print(tostring(tot)..' '..tostring(ur)) while ur > 0 do line,col,name = j.nextline(true) print(tostring(name)..'|'..tostring(line)..'|'..tostring(col)) tot,ur = j.count() end print(sl.exkeyvalstr(j.gmatchcolor(start, color, 'c(ur)'))) start = tot + 1 end wait(50) end
-> 8 8 |Login confirm on RunUO TC|55 |Welcome to Ultima Online!|0 |Welcome, ximansu! There is currently 1 user online, with 100021 items and 2419 mobiles in the world.|946 |Queuing action request 2... 1.6 seconds left.|173 |Chat is not currently supported.|946 |Finished 3 queued actions in 1.4 seconds.|173 |The world is saving, please wait.|53 |World save complete. The entire process took 0.2 seconds.|53 table keys:values = { 1:table keys:values = { 1:ur, }, 2:table keys:values = { 1:ur, }, linenums:table keys:values = { 1:3, 2:5, }, count:2, }
Description
Refresh checks to see if there are more journal messages, and if so, copies them to the internal store, returning the number of new messages, the total number of messages, and the number unread since the last call to mark or nextline.
Refresh, along with clear and nextline, are the only methods which force an update to the internal store.