Difference between revisions of "Journal"
From OpenEUO
m |
m (→Example) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | ''journal | + | == Calling Pattern == |
+ | Call | ||
+ | local j = sl.journal() | ||
+ | Results | ||
+ | j is a journal closure | ||
+ | |||
+ | == Closure Methods == | ||
+ | |||
+ | * [[journal.clear]] | ||
+ | * [[journal.count]] | ||
+ | * [[journal.line]] | ||
+ | * [[journal.mark]] | ||
+ | * [[journal.nextln]] | ||
+ | * [[journal.nextline]] | ||
+ | * [[journal.refresh]] | ||
+ | |||
+ | |||
+ | * [[journal.find]] | ||
+ | * [[journal.findcolor]] | ||
+ | * [[journal.gmatch]] | ||
+ | * [[journal.gmatchcolor]] | ||
+ | * [[journal.gsub]] | ||
+ | * [[journal.gsubcolor]] | ||
+ | * [[journal.match]] | ||
+ | * [[journal.matchcolor]] | ||
+ | * [[journal.sub]] | ||
+ | * [[journal.subcolor]] | ||
+ | |||
+ | == 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 == | ||
+ | |||
+ | Use journal to generate a journal tracking/searching object. Journal takes no arguments and returns a closure with numerous methods simplifying journal access. All methods work on a passive internal copy of the UO journal, with the exception of [[journal.refresh|refresh]], [[journal.nextline|nextline]], and [[journal.clear|clear]]. Those all cause the internal copy of the journal to be updated with any new data from the associated client journal. For more information, see the associated member methods. | ||
+ | |||
+ | ''Journal is inspired by and partially modeled upon Kal In Ex's journal library.'' | ||
== See Also == | == See Also == | ||
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | * [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | ||
+ | |||
+ | * [[keymon]] | ||
+ | |||
+ | * [[journal.nextline]] | ||
+ | |||
+ | * [[journal.refresh]] | ||
+ | |||
+ | * [[machine]] | ||
+ | |||
+ | * [[spin]] | ||
+ | |||
+ | * [[str]] | ||
+ | |||
+ | * [http://www.easyuo.com/openeuo/wiki/index.php/Documentation#String_Functions string] |
Latest revision as of 18:35, 8 January 2011
Calling Pattern
Call
local j = sl.journal()
Results
j is a journal closure
Closure Methods
- journal.clear
- journal.count
- journal.line
- journal.mark
- journal.nextln
- journal.nextline
- journal.refresh
- journal.find
- journal.findcolor
- journal.gmatch
- journal.gmatchcolor
- journal.gsub
- journal.gsubcolor
- journal.match
- journal.matchcolor
- journal.sub
- journal.subcolor
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
Use journal to generate a journal tracking/searching object. Journal takes no arguments and returns a closure with numerous methods simplifying journal access. All methods work on a passive internal copy of the UO journal, with the exception of refresh, nextline, and clear. Those all cause the internal copy of the journal to be updated with any new data from the associated client journal. For more information, see the associated member methods.
Journal is inspired by and partially modeled upon Kal In Ex's journal library.