|
13 | 13 | #include "../../Plugins/inc/plugins/LuaPlugin.h" |
14 | 14 |
|
15 | 15 | typedef const char *(*GetPlugin)(); |
| 16 | +typedef double (*GetCount)(); |
16 | 17 |
|
17 | 18 | const char *GetCppVersion() |
18 | 19 | { |
@@ -218,11 +219,19 @@ void SwiftlyPluginManagerInfo(CPlayerSlot *slot, CCommandContext context, std::s |
218 | 219 |
|
219 | 220 | std::string website = plugin->ExecuteFunctionWithReturn<const char *, GetPlugin>("GetPluginWebsite"); |
220 | 221 |
|
221 | | - PrintToClientOrConsole(slot, "Plugin Info", "Plugin File Name: %s\n", (plugin->GetName() + WIN_LINUX(".dll", ".so")).c_str()); |
| 222 | + PrintToClientOrConsole(slot, "Plugin Info", "Plugin File Name: %s\n", plugin->m_path.c_str()); |
222 | 223 | PrintToClientOrConsole(slot, "Plugin Info", "Name: %s\n", plugin->ExecuteFunctionWithReturn<const char *, GetPlugin>("GetPluginName")); |
223 | 224 | PrintToClientOrConsole(slot, "Plugin Info", "Author: %s\n", plugin->ExecuteFunctionWithReturn<const char *, GetPlugin>("GetPluginAuthor")); |
224 | 225 | PrintToClientOrConsole(slot, "Plugin Info", "Version: %s\n", plugin->ExecuteFunctionWithReturn<const char *, GetPlugin>("GetPluginVersion")); |
225 | 226 | PrintToClientOrConsole(slot, "Plugin Info", "URL: %s\n", website == "" ? "Not Present" : website.c_str()); |
| 227 | + if (plugin->GetPluginType() == PluginType_t::PLUGIN_LUA) |
| 228 | + { |
| 229 | + LuaPlugin *plg = (LuaPlugin *)plugin; |
| 230 | + LuaFuncWrapper wrapper(plg->GetLuaState()->Get("collectgarbage")); |
| 231 | + wrapper.PrepForExec(); |
| 232 | + luacpp::PushValues(wrapper.GetML(), "count"); |
| 233 | + PrintToClientOrConsole(slot, "Plugin Info", "Memory Usage: %.4fMB\n", (wrapper.ExecuteWithReturn<double>("collectgarbage", 1) / 1024)); |
| 234 | + } |
226 | 235 | } |
227 | 236 |
|
228 | 237 | void SwiftlyPluginManagerUnload(CPlayerSlot *slot, CCommandContext context, std::string plugin_name) |
|
0 commit comments