diff options
author | Bill Derouin <derouinbill@gmail.com> | 2014-01-07 20:47:15 +0100 |
---|---|---|
committer | Bill Derouin <derouinbill@gmail.com> | 2014-01-07 20:47:15 +0100 |
commit | e0d94e0f06e5e39319f68497479720e04f10ce58 (patch) | |
tree | 75024532d1f5c8034ab11059212706241e5560e2 /src/Bindings/PluginLua.cpp | |
parent | Removed bitdeli badge - we have GitHub analytics now. (diff) | |
download | cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.tar cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.tar.gz cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.tar.bz2 cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.tar.lz cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.tar.xz cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.tar.zst cuberite-e0d94e0f06e5e39319f68497479720e04f10ce58.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/PluginLua.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 209842e55..196a4f730 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -90,6 +90,8 @@ bool cPluginLua::Initialize(void) // Load all files for this plugin, and execute them AStringVector Files = cFile::GetFolderContents(PluginPath.c_str()); + + int numFiles = 0; for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) { if (itr->rfind(".lua") == AString::npos) @@ -101,9 +103,19 @@ bool cPluginLua::Initialize(void) { Close(); return false; + } else + { + numFiles++; } } // for itr - Files[] + if (numFiles == 0) // no lua files found + { + LOGWARNING("No lua files found: plugin %s is missing.", GetName().c_str()); + Close(); + return false; + } + // Call intialize function bool res = false; if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res)) |