# HG changeset patch # User Matthew Wild # Date 1396468434 -3600 # Node ID 7f0e6f8bb8e0bbc607f52e7fb216beaf14238d28 # Parent 1f41c74ce686cf01d502275ee72fd62068ae2b4c Expose expat's XML_GetCurrentByteCount() method as parser:getcurrentbytecount() diff -r 1f41c74ce686 -r 7f0e6f8bb8e0 src/lxplib.c --- 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},