Changeset 6417 for code/trunk/src/libraries/core/LuaState.h
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/LuaState.h
r5781 r6417 40 40 41 41 #include "util/ScopeGuard.h" 42 #include "core/Functor.h" 42 43 #include "ToluaInterface.h" 43 44 44 // tolua_begin 45 namespace orxonox 46 { 45 namespace orxonox // tolua_export 46 { // tolua_export 47 class Functor; // tolua_export 48 49 //! Functor subclass that simply executes code with 0 arguments. 50 class _CoreExport LuaFunctor : public Functor 51 { 52 public: 53 LuaFunctor(const std::string& code, LuaState* luaState); 54 void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null); 55 void evaluateParam(unsigned int index, MultiType& param) const {} 56 57 private: 58 std::string code_; 59 LuaState* lua_; 60 }; 61 62 47 63 /** 48 64 @brief 49 65 Representation of an interface to lua 50 66 */ 51 class _CoreExport LuaState 52 { 53 // tolua_end 67 class _CoreExport LuaState // tolua_export 68 { // tolua_export 54 69 public: 55 70 LuaState(); 56 71 ~LuaState(); 57 72 58 void doFile(const std::string& filename , const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export59 void doString(const std::string& code, shared_ptr<ResourceInfo>sourceFileInfo = shared_ptr<ResourceInfo>());73 void doFile(const std::string& filename); // tolua_export 74 void doString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo = shared_ptr<ResourceInfo>()); 60 75 61 void includeFile(const std::string& filename , const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export62 void includeString(const std::string& code, shared_ptr<ResourceInfo>sourceFileInfo = shared_ptr<ResourceInfo>());76 void includeFile(const std::string& filename); // tolua_export 77 void includeString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo = shared_ptr<ResourceInfo>()); 63 78 64 79 void luaPrint(const std::string& str); // tolua_export 65 80 void luaLog(unsigned int level, const std::string& message); // tolua_export 66 bool fileExists(const std::string& filename , const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export81 bool fileExists(const std::string& filename); // tolua_export 67 82 68 83 const std::stringstream& getOutput() const { return output_; } … … 72 87 lua_State* getInternalLuaState() { return luaState_; } 73 88 89 void setDefaultResourceInfo(const shared_ptr<ResourceInfo>& sourceFileInfo) { this->sourceFileInfo_ = sourceFileInfo; } 90 const shared_ptr<ResourceInfo>& getDefaultResourceInfo() { return this->sourceFileInfo_; } 91 92 Functor* createLuaFunctor(const std::string& code) { return new LuaFunctor(code, this); } // tolua_export 93 74 94 static bool addToluaInterface(int (*function)(lua_State*), const std::string& name); 75 95 static bool removeToluaInterface(const std::string& name); … … 78 98 79 99 private: 80 shared_ptr<ResourceInfo> getFileInfo(const std::string& filename , const std::string& resourceGroup, bool bSearchOtherPaths);100 shared_ptr<ResourceInfo> getFileInfo(const std::string& filename); 81 101 82 102 #if LUA_VERSION_NUM != 501
Note: See TracChangeset
for help on using the changeset viewer.