summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2007-04-02 23:35:08 +0000
committerpixel <pixel>2007-04-02 23:35:08 +0000
commitc333001750bf29cb34c5b52abd9572563943c1e5 (patch)
treeb7f86b06a845b4b924872e7df37d7849e2280903 /lib
parent77a52d07f442fef2b91971b6c6bf942aaa73071c (diff)
Consolidating the Lua-XML parser a bit more.
Diffstat (limited to 'lib')
-rw-r--r--lib/LuaXML.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/LuaXML.cc b/lib/LuaXML.cc
index 93a3fb7..4f9c6ba 100644
--- a/lib/LuaXML.cc
+++ b/lib/LuaXML.cc
@@ -74,6 +74,7 @@ static int LuaXML_ParseString(lua_State *L) {
doc.Parse(xml_string);
lua_newtable(L);
LuaXML_ParseNode(L, &doc);
+ return 1;
}
#define XMLBUFSIZ 81920
@@ -87,12 +88,15 @@ static int LuaXML_ParseHandle(lua_State *__L) {
while (!h->IsClosed()) {
l = h->read(buffer, XMLBUFSIZ);
- buffer[l] = 0;
- doc.Parse(buffer);
+ if (l) {
+ buffer[l] = 0;
+ doc.Parse(buffer);
+ }
}
lua_newtable(__L);
LuaXML_ParseNode(__L, &doc);
+ return 1;
}
static const luaL_reg xmllib[] = {