Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:TextLogLoadFromFile

From RoR Wiki

UI Lua API · TextLog functions
Version: WAR 1.4.8

Reads a UTF-16 log file and adds each line to a text log as a new entry.

TextLogLoadFromFile(logName, fileName)

Arguments

logName
string – Name of the text log to add the lines to.
fileName
wstring – Path of the file. It must be inside the client's log directory.

Returns

Nothing.

Details

  • The file must start with a UTF-16 byte-order mark. Otherwise the is not a valid unicode log file error is raised.
  • The file is split at line feeds. Each line is added as if by TextLogAddEntry with filter type 0, so the usual rules apply: the entry limit, the enabled flag, the update event and incremental saving.
  • The whole line becomes the entry text. A file written by incremental saving therefore gives entries that start with the saved date, time and filter name, and that end with the carriage return written before each line feed.
  • If incremental saving to the same log is on, the loaded lines are written to the log's file again.
  • If the file does not exist, nothing is loaded.
  • 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 'TextLogLoadFromFile': Text Log %s does not exist
  • Error in function call 'TextLogLoadFromFile': File '%s' is not in the log directory '%s'.
  • Error in function call 'TextLogLoadFromFile': File '%s' is not a valid unicode log file.
    This message is formatted as a narrow string while the file name is a wide string, so usually only the first character of the name appears.

Example

A minimal example built from the documented signature:

TextLogCreate( "OldLog", 1000 )
TextLogLoadFromFile( "OldLog", L"logs/uilog.log" )

See also