From 48cec90c3f1e81daec3d216ddf4db1ea1e2a8341 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 9 Apr 2013 13:43:24 +0000 Subject: Added Expat and LuaExpat, XML parsing now available in the API. FS #336 Windows version only, Linux to be fixed soon. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1374 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Debuggers/Debuggers.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'MCServer') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index c1c0e1fe6..bf1cf516b 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -69,6 +69,8 @@ function Initialize(Plugin) BA1:Merge(BA2, 1, 10, 1, cBlockArea.msImprint); BA1:SaveToSchematicFile("schematics/merge.schematic"); end + else + BA1:Create(16, 16, 16); end -- Debug block area cuboid filling: @@ -166,6 +168,31 @@ function Initialize(Plugin) LOG("SQLite3 failed to open DB! (" .. ErrCode .. ", " .. ErrMsg ..")"); end + + -- Debug LuaExpat binding: + local count = 0 + callbacks = { + StartElement = function (parser, name) + LOG("+ " .. string.rep(" ", count) .. name); + count = count + 1; + end, + EndElement = function (parser, name) + count = count - 1; + LOG("- " .. string.rep(" ", count) .. name); + end + } + + local p = lxp.new(callbacks); + p:parse("\nnext line\nanother line"); + p:parse("text\n"); + p:parse("\n"); + p:parse("more text"); + p:parse(""); + p:parse("\n"); + p:parse() -- finishes the document + p:close() -- closes the parser + + return true end -- cgit v1.2.3