Expose expat's XML_GetCurrentByteCount() method as parser:getcurrentbytecount()

Wed, 02 Apr 2014 20:53:54 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 02 Apr 2014 20:53:54 +0100
changeset 17
7f0e6f8bb8e0
parent 16
1f41c74ce686
child 18
90da47758f85

Expose expat's XML_GetCurrentByteCount() method as parser:getcurrentbytecount()

src/lxplib.c file | annotate | diff | comparison | revisions
--- a/src/lxplib.c	Thu May 30 05:02:24 2013 +0700
+++ b/src/lxplib.c	Wed Apr 02 20:53:54 2014 +0100
@@ -524,11 +524,18 @@
 #define luaL_Reg luaL_reg
 #endif
 
+static int lxp_getcurrentbytecount (lua_State* L) {
+  lxp_userdata *xpu = checkparser(L, 1);
+  lua_pushinteger(L, XML_GetCurrentByteCount(xpu->parser));
+  return 1;
+}
+
 static const struct luaL_Reg lxp_meths[] = {
   {"parse", lxp_parse},
   {"close", lxp_close},
   {"__gc", parser_gc},
   {"pos", lxp_pos},
+  {"getcurrentbytecount", lxp_getcurrentbytecount},
   {"setencoding", lxp_setencoding},
   {"getcallbacks", getcallbacks},
   {"getbase", getbase},

mercurial