Cleaned up scripts directory

Made scripts runnable at startup
Added printing functions and remapped default Lua printing
This commit is contained in:
Alexander Bock
2014-08-29 13:04:20 +02:00
parent 1782857c72
commit 79174d5b6c
17 changed files with 221 additions and 59 deletions
+11 -1
View File
@@ -28,6 +28,9 @@
#include <ghoul/lua/ghoul_lua.h>
#include <set>
namespace openspace {
namespace scripting {
class ScriptEngine {
public:
struct LuaLibrary {
@@ -43,14 +46,21 @@ public:
bool addLibrary(const LuaLibrary& library);
bool hasLibrary(const std::string& name);
bool runScript(std::string script);
bool runScript(const std::string& script);
bool runScriptFile(const std::string& filename);
private:
bool isLibraryNameAllowed(const std::string& name);
void addLibraryFunctions(const LuaLibrary& library, bool replace);
void addBaseLibrary();
void remapPrintFunction();
lua_State* _state;
std::set<unsigned int> _registeredLibraries;
};
} // namespace scripting
} // namespace openspace
#endif // __SCRIPTENGINE_H__