summaryrefslogtreecommitdiff
path: root/server/src/luaquerymapper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/luaquerymapper.cc')
-rw-r--r--server/src/luaquerymapper.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/server/src/luaquerymapper.cc b/server/src/luaquerymapper.cc
index acd6b26..9f8293d 100644
--- a/server/src/luaquerymapper.cc
+++ b/server/src/luaquerymapper.cc
@@ -53,7 +53,7 @@ static std::string loadresultstring(QueryResult &res, std::string group = "")
return s;
}
-LUAQueryMapper::LUAQueryMapper(QueryResult &res)
+LUAQueryMapper::LUAQueryMapper()
{
L = luaL_newstate();
if(L == NULL) {
@@ -63,7 +63,17 @@ LUAQueryMapper::LUAQueryMapper(QueryResult &res)
luaL_openlibs(L);
- std::string preload = loadresultstring(res);
+ clean_top = lua_gettop(L);
+}
+
+LUAQueryMapper::~LUAQueryMapper()
+{
+ lua_close(L);
+}
+
+void LUAQueryMapper::addQueryResult(QueryResult &result)
+{
+ std::string preload = loadresultstring(result);
if(luaL_loadbuffer(L, preload.c_str(), preload.size(), "preload")) {
error(lua_tostring(L, lua_gettop(L)));
@@ -79,11 +89,6 @@ LUAQueryMapper::LUAQueryMapper(QueryResult &res)
clean_top = lua_gettop(L);
}
-LUAQueryMapper::~LUAQueryMapper()
-{
- lua_close(L);
-}
-
Value LUAQueryMapper::map(const std::string &mapper)
{
Value v;