summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginLua.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-17 23:12:46 +0100
committermadmaxoft <github@xoft.cz>2014-02-17 23:12:46 +0100
commit865ae82114c7c567f3d2580f648979ad5101e0db (patch)
tree3a21dc6321acd67d1f478576fb7decb37bf6b514 /src/Bindings/PluginLua.cpp
parentMerge pull request #690 from tonibm19/master (diff)
downloadcuberite-865ae82114c7c567f3d2580f648979ad5101e0db.tar
cuberite-865ae82114c7c567f3d2580f648979ad5101e0db.tar.gz
cuberite-865ae82114c7c567f3d2580f648979ad5101e0db.tar.bz2
cuberite-865ae82114c7c567f3d2580f648979ad5101e0db.tar.lz
cuberite-865ae82114c7c567f3d2580f648979ad5101e0db.tar.xz
cuberite-865ae82114c7c567f3d2580f648979ad5101e0db.tar.zst
cuberite-865ae82114c7c567f3d2580f648979ad5101e0db.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/PluginLua.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 773d522c4..45c8216be 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -82,6 +82,14 @@ bool cPluginLua::Initialize(void)
lua_pushstring(m_LuaState, GetName().c_str());
lua_setglobal(m_LuaState, LUA_PLUGIN_NAME_VAR_NAME);
+ // Add the plugin's folder to the package.path and package.cpath variables (#693):
+ m_LuaState.AddPackagePath("path", FILE_IO_PREFIX + GetLocalFolder() + "/?.lua");
+ #ifdef _WIN32
+ m_LuaState.AddPackagePath("cpath", GetLocalFolder() + "\\?.dll");
+ #else
+ m_LuaState.AddPackagePath("cpath", FILE_IO_PREFIX + GetLocalFolder() + "/?.so");
+ #endif
+
tolua_pushusertype(m_LuaState, this, "cPluginLua");
lua_setglobal(m_LuaState, "g_Plugin");
}