diff options
author | Pixel <pixel@nobis-crew.org> | 2008-10-23 17:02:47 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2008-10-23 17:02:47 -0700 |
commit | e2696aa19728e013300f78aa53efe7ab5fdc9a27 (patch) | |
tree | 5a3c5332decabc17e76ce4deeac02810a727289e /doc | |
parent | 73a6afb6d7dec1da25fb60a8bf208cf6c419fe92 (diff) |
Adding more doc.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/Lua-API | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/doc/Lua-API b/doc/Lua-API index a914ec0..b15e911 100644 --- a/doc/Lua-API +++ b/doc/Lua-API @@ -95,6 +95,66 @@ table, dir, and debug. The io library is considered dangerous, thus the addition of the mkdir and time functions within the base library. +- XML parser - + +If opened by the C++ host, the Lua VM may have the xml table, containing two +functions, called LoadString and LoadHandle. They'll both try to parse an XML +document, and return its result. Here's a full example: + +Input XML file: + +<?xml version="1.0" encoding="UTF-8"?> +<html> + <head> + <title>Test</title> + </head> + + <body bgcolor="#ffeedd">Normal test + <br /> + + <b>Bold test.</b> + + <!-- Hi there... --> + + </body> +</html> + +Output Lua table: + +{ + [1] = { + [1] = { + [1] = { + [1] = "Test", + ["name"] = "title", + ["n"] = 1, + }, + ["name"] = "head", + ["n"] = 1, + }, + [2] = { + [1] = "Normal test", + [2] = { + ["name"] = "br", + }, + [3] = { + [1] = "Bold test.", + ["name"] = "b", + ["n"] = 1, + }, + ["attr"] = { + ["bgcolor"] = "#ffeedd", + }, + ["name"] = "body", + ["n"] = 3, + }, + ["name"] = "html", + ["n"] = 2, + }, + ["n"] = 1, +} + + == Objects exported to the Lua VM == The C++ host may or may not export the classes to the Lua VM. The list here is @@ -249,4 +309,23 @@ cflags, and no flags set for eflags. The resulting object will have the method Match, which takes one string as argument, and returns a boolean telling if the string has matched, as well as -a table with the list of the submatches.
\ No newline at end of file +a table with the list of the submatches. + + +- ConfigFile - + +This object will read a Handle and transform it into a read-only associative +array. So its constructor only takes one handle. The structure of the ini files +it'll read is the standard windows-like files, such as: + +[section1] +name1=value1 +name2=value2 + +[section2] +name1=value1 + +And any ConfigFile object will have two tables named section1 and section2 +containing the indexes mentionned in the exemple. + + |