diff options
Diffstat (limited to 'Sluift/ElementConvertors/DOMElementConvertor.cpp')
| -rw-r--r-- | Sluift/ElementConvertors/DOMElementConvertor.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Sluift/ElementConvertors/DOMElementConvertor.cpp b/Sluift/ElementConvertors/DOMElementConvertor.cpp index fb1f658..784fcfd 100644 --- a/Sluift/ElementConvertors/DOMElementConvertor.cpp +++ b/Sluift/ElementConvertors/DOMElementConvertor.cpp @@ -29,18 +29,19 @@ using namespace Swift; namespace { class ParserClient : public XMLParserClient { public: ParserClient(lua_State* L) : L(L), currentIndex(1) { } virtual void handleStartElement( const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE { + lua_checkstack(L, 6); lua_pushnumber(L, currentIndex); lua_newtable(L); lua_pushstring(L, element.c_str()); lua_setfield(L, -2, "tag"); if (!ns.empty()) { lua_pushstring(L, ns.c_str()); lua_setfield(L, -2, "ns"); } if (!attributes.getEntries().empty()) { @@ -72,18 +73,19 @@ namespace { const std::string&, const std::string&) SWIFTEN_OVERRIDE { lua_setfield(L, -2, "children"); lua_settable(L, -3); currentIndex = indexStack.back(); indexStack.pop_back(); currentIndex++; } virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE { + lua_checkstack(L, 2); lua_pushnumber(L, currentIndex); lua_pushstring(L, data.c_str()); lua_settable(L, -3); currentIndex++; } private: lua_State* L; std::vector<int> indexStack; |
Swift