Description
A simple library providing some commonly used utility functions. This library solves the problem of reading and writing to a file for communication with an external program!
Reporting Bugs
Requirements
LibCereal-1.0 must be installed.
Function Documentation
LibUtils.Chat( text ) / Chat( text )
Description
Sends a line of text to the primary chat window.
Parameters
text - A line of text in either string or wstring format.
Returns
Nothing
LibUtils.Dbg( text ) / dbg( text )
Description
Sends a line of text to debug window.
Parameters
text - A line of text in either string or wstring format.
Returns
Nothing
LibUtils.Dump( lua_object, label ) / Dump( lua_object, label )
Description
Prints out the lua_object in string format to the Chat window. It uses the chat window rather than the debug window because the debug window truncates the output.
Parameters
lua_object - Any lua object
Returns
Nothing
LibUtils.LoadFile( filename )
Description
Loads and de-serializes the contents of a file created by LibUtils.SaveFile()
Parameters
filename - The name of the file to load.
Returns
A single Lua object
LibUtils.PlayerName()
Description
Determines the name of the current character.
Parameters
none
Returns
A string containing the name of the current character.
LibUtils.SaveFile( filename, lua_object )
Description
Stores a single lua object (such as a table or a string) to the named file.
Parameters
filename - The filename to write to. lua_object - The object to be stored.
Returns
Nothing
LibUtils.SendCommand( cmd )
Description
Causes a single slash command to be executed. For example, "/target maudib"
Parameters
cmd - Either a string or widestring to be executed.
Returns
Nothing
LibUtils.StrJoin( ) / strjoin()
Description
Parameters
Returns
LibUtils.StrSplit() / strsplit()
Description
Parameters
Returns
- 3 comments
- 3 comments
Facts
- Date created
- 09 Dec 2008
- Categories
- Last update
- 12 Dec 2008
- Development stage
- Inactive
- Language
- enUS
- License
- GNU Lesser General Public License version 3 (LGPLv3)
- Curse link
- LibUtils
- Recent files
- R: LibUtils 0.02 for Beta 3.0 on 12 Dec 2008
- B: Lib Utils 0.01 Beta for None on 09 Dec 2008
- #3
Master_Jochen Fri, 24 Apr 2009 22:49:54Ok i got for other coders a example for Delphi to convert in standart delphi can read If this post is not ok please erase it. Ps: i searched very long to find it.
- #2
multox Sat, 20 Dec 2008 06:18:20Hi Fishmouth,
UTF-16 LE means UTF-16 in the Little Endian format, which is the format that x86 processors use. UTF-16 is a unicode standard and you should be able to read/write this file using fixed-width wide character representations in most programming languages.
Many applications support this format. Most likely, the application that you're using is trying to read the file in UTF-8. For an example, try reading the file with notepad.exe. Notepad is able to read and write the file correctly. (At least on my Vista 64 machine.)
Please note that if you write data to the file from an external application, then it will need to be in the serialized format required by LibCereal-1.0. For an example, try hard-coding the data into your mod first, then saving it to see the format that it should be in.
If I am misunderstanding or could use any more help, please let me know.
Sincerely, Multox
- #1
fishmouth Tue, 16 Dec 2008 15:03:18(excuse my englisch) In your documentation of LibUtils you said: "-- - We can easily communicate with external applications."
But i figured out, that this isnt that easy. If you look closely at the asdfasdf.txt created by the LibUtils.TestSaveLoad function in an Hex-Editor, you see that it is using the UTF-16 LE (LE!) character set, that means the first four hexadecimal chars of the file are FFFE and the hex-chars 3 and 4 of every following Letter in the txt are always 00 (so an "a" is 6100 in hex). The Problem is, that txts created by other applications use another character set and LibUtils.LoadFile/WAR cant read it. (because of the missing FFFE and xx00 hex). Any idea to force applications in general to save in UTF-16 LE? (maybe through an externat application?)
So long LibUtils can only read txts created by itself.
greetings fishmouth