diff options
author | deva <deva> | 2009-01-13 10:07:58 +0000 |
---|---|---|
committer | deva <deva> | 2009-01-13 10:07:58 +0000 |
commit | bcabb130408b5d52bb73f8404d3b4805047d86ff (patch) | |
tree | ee7b347f814c9728f24bc2f266fd1fb8e247bcdc /server/src/luaformatmapper.cc | |
parent | f2710089a722fc55970813fab2d27ae3e23a9c97 (diff) |
Changes for new multilist type... to be removed again in a minute.
Diffstat (limited to 'server/src/luaformatmapper.cc')
-rw-r--r-- | server/src/luaformatmapper.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/server/src/luaformatmapper.cc b/server/src/luaformatmapper.cc index 6c0115d..652a34d 100644 --- a/server/src/luaformatmapper.cc +++ b/server/src/luaformatmapper.cc @@ -31,20 +31,22 @@ #include "exception.h" #include "luaformatmapperutils.h" - +/* static std::string loadresultstring(Fields &fields) { std::string s; Fields::iterator v = fields.begin(); while(v != fields.end()) { - s += (*v).first + " = \"" + (*v).second + "\"\n"; + lua_pushstring(L, v->second); // Push the pointer to 'this' instance + lua_setglobal(L, v->first); // Assign it to a global lua var. + // s += (*v).first + " = \"" + (*v).second + "\"\n"; v++; } return s; } - +*/ LUAFormatMapper::LUAFormatMapper(Fields &fields) { L = luaL_newstate(); @@ -58,6 +60,13 @@ LUAFormatMapper::LUAFormatMapper(Fields &fields) setGlobal(L, "LUAFormatMapper", this); preload_formatutils(L); + Fields::iterator v = fields.begin(); + while(v != fields.end()) { + lua_pushstring(L, v->second.c_str()); // Push the pointer to 'this' instance + lua_setglobal(L, v->first.c_str()); // Assign it to a global lua var. + v++; + } + /* std::string preload = loadresultstring(fields); if(luaL_loadbuffer(L, preload.c_str(), preload.size(), "preload")) { @@ -70,7 +79,7 @@ LUAFormatMapper::LUAFormatMapper(Fields &fields) error(lua_tostring(L, lua_gettop(L))); return; } - + */ clean_top = lua_gettop(L); } |