diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-14 01:34:47 +0200 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-14 01:34:47 +0200 |
commit | 41ba1a7642105ac21b67f4febac3eceef6a39f0a (patch) | |
tree | aec9b8bfcde7f1ad44e2cb28149a41a091f60465 /source/ManualBindings.cpp | |
parent | Better split of the fluid simulator functionality; removed the old LavaSimulator and WaterSimulator files. (diff) | |
download | cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.tar cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.tar.gz cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.tar.bz2 cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.tar.lz cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.tar.xz cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.tar.zst cuberite-41ba1a7642105ac21b67f4febac3eceef6a39f0a.zip |
Diffstat (limited to 'source/ManualBindings.cpp')
-rw-r--r-- | source/ManualBindings.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index dca4e0083..39677b7a8 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -521,17 +521,27 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State* tolua_S) { cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const cPluginManager::PluginList & AllPlugins = self->GetAllPlugins(); + const cPluginManager::PluginMap & AllPlugins = self->GetAllPlugins(); - lua_createtable(tolua_S, AllPlugins.size(), 0); + lua_newtable(tolua_S); + //lua_createtable(tolua_S, AllPlugins.size(), 0); int newTable = lua_gettop(tolua_S); int index = 1; - cPluginManager::PluginList::const_iterator iter = AllPlugins.begin(); + cPluginManager::PluginMap::const_iterator iter = AllPlugins.begin(); while(iter != AllPlugins.end()) { - const cPlugin* Plugin = *iter; - tolua_pushusertype( tolua_S, (void*)Plugin, "const cPlugin" ); - lua_rawseti(tolua_S, newTable, index); + const cPlugin* Plugin = iter->second; + tolua_pushstring( tolua_S, iter->first.c_str() ); + if( Plugin != NULL ) + { + tolua_pushusertype( tolua_S, (void*)Plugin, "const cPlugin" ); + } + else + { + tolua_pushboolean(tolua_S, 0); + } + //lua_rawseti(tolua_S, newTable, index); + lua_rawset(tolua_S, -3); ++iter; ++index; } |