made functions for script sharing public for now, temporary fix

This commit is contained in:
Joakim Kilby
2015-06-26 13:54:00 +02:00
parent 06ca17326e
commit 8cc1498b57
2 changed files with 95 additions and 55 deletions

View File

@@ -28,6 +28,7 @@
#include <ghoul/lua/ghoul_lua.h>
#include <set>
#include <map>
/**
* \defgroup LuaScripts Lua Scripts
@@ -89,9 +90,16 @@ public:
void preSynchronization();
void queueScript(const std::string &script);
std::vector<std::string> cachedScripts();
std::vector<std::string> allLuaFunctions() const;
//parallel functions
bool parseLibraryAndFunctionNames(std::string &library, std::string &function, const std::string &script);
bool shouldScriptBeSent(const std::string &library, const std::string &function);
void cacheScript(const std::string &library, const std::string &function, const std::string &script);
private:
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
void addLibraryFunctions(lua_State* state, const LuaLibrary& library, bool replace);
@@ -100,8 +108,6 @@ private:
void addBaseLibrary();
void remapPrintFunction();
bool findLibraryAndFunction(std::string &library, std::string &function, const std::string &script);
lua_State* _state;
std::set<LuaLibrary> _registeredLibraries;
@@ -112,6 +118,10 @@ private:
std::vector<std::string> _receivedScripts;
std::string _currentSyncedScript;
//parallel variables
std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
std::mutex _cachedScriptsMutex;
};
} // namespace scripting