diff options
Diffstat (limited to 'Sluift/Lua/LuaUtils.cpp')
-rw-r--r-- | Sluift/Lua/LuaUtils.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Sluift/Lua/LuaUtils.cpp b/Sluift/Lua/LuaUtils.cpp index 915f3cc..dbadaab 100644 --- a/Sluift/Lua/LuaUtils.cpp +++ b/Sluift/Lua/LuaUtils.cpp @@ -189,3 +189,11 @@ void Swift::Lua::registerExtraHelp(lua_State* L, int index, const std::string& n } lua_pop(L, 3); } + +void Swift::Lua::pushStringArray(lua_State* L, const std::vector<std::string>& strings) { + lua_createtable(L, strings.size(), 0); + for (size_t i = 0; i < strings.size(); ++i) { + lua_pushstring(L, strings[i].c_str()); + lua_rawseti(L, -2, boost::numeric_cast<int>(i+1)); + } +} |