mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
Add a --enable-lua switch to enable LUA support
This commit is contained in:
@@ -69,7 +69,9 @@
|
||||
#endif
|
||||
|
||||
#include <daemonc/remotecontrol.h>
|
||||
#if ENABLE_LUA
|
||||
#include <gui/luainstance.h>
|
||||
#endif
|
||||
|
||||
extern CPlugins * g_PluginList; /* neutrino.cpp */
|
||||
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
||||
@@ -128,8 +130,10 @@ void CPlugins::scanDir(const char *dir)
|
||||
new_plugin.pluginfile = fname;
|
||||
if (new_plugin.type == CPlugins::P_TYPE_SCRIPT)
|
||||
new_plugin.pluginfile.append(".sh");
|
||||
#if ENABLE_LUA
|
||||
else if (new_plugin.type == CPlugins::P_TYPE_LUA)
|
||||
new_plugin.pluginfile.append(".lua");
|
||||
#endif
|
||||
else
|
||||
new_plugin.pluginfile.append(".so");
|
||||
// We do not check if new_plugin.pluginfile exists since .cfg in
|
||||
@@ -344,6 +348,7 @@ void CPlugins::startScriptPlugin(int number)
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LUA
|
||||
void CPlugins::startLuaPlugin(int number)
|
||||
{
|
||||
const char *script = plugin_list[number].pluginfile.c_str();
|
||||
@@ -358,6 +363,7 @@ void CPlugins::startLuaPlugin(int number)
|
||||
lua->runScript(script);
|
||||
delete lua;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CPlugins::startPlugin(int number,int /*param*/)
|
||||
{
|
||||
@@ -384,11 +390,13 @@ void CPlugins::startPlugin(int number,int /*param*/)
|
||||
startScriptPlugin(number);
|
||||
return;
|
||||
}
|
||||
#if ENABLE_LUA
|
||||
if (plugin_list[number].type == CPlugins::P_TYPE_LUA)
|
||||
{
|
||||
startLuaPlugin(number);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!file_exists(plugin_list[number].pluginfile.c_str()))
|
||||
{
|
||||
printf("[CPlugins] could not find %s,\nperhaps wrong plugin type in %s\n",
|
||||
@@ -655,8 +663,10 @@ CPlugins::p_type_t CPlugins::getPluginType(int type)
|
||||
case PLUGIN_TYPE_SCRIPT:
|
||||
return P_TYPE_SCRIPT;
|
||||
break;
|
||||
#if ENABLE_LUA
|
||||
case PLUGIN_TYPE_LUA:
|
||||
return P_TYPE_LUA;
|
||||
#endif
|
||||
default:
|
||||
return P_TYPE_DISABLED;
|
||||
}
|
||||
|
Reference in New Issue
Block a user