Changeset 6626 for code/branches/gamestate/src
- Timestamp:
- Mar 28, 2010, 7:16:12 PM (15 years ago)
- Location:
- code/branches/gamestate/src/libraries/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestate/src/libraries/core/LuaState.cc
r6625 r6626 135 135 136 136 std::string chunkname; 137 if (sourceFileInfo != NULL && !sourceFileInfo->fileSystemPath.empty())137 if (sourceFileInfo != NULL) 138 138 { 139 139 // Provide lua_load with the filename for debug purposes 140 140 // The '@' is a Lua convention to identify the chunk name as filename 141 chunkname = '@' + sourceFileInfo->file SystemPath;142 } 143 else 144 { 145 // Use the beginning of thecode string to identify the chunk146 chunkname = code .substr(0, 80);141 chunkname = '@' + sourceFileInfo->filename; 142 } 143 else 144 { 145 // Use the code string to identify the chunk 146 chunkname = code; 147 147 } 148 148 … … 195 195 } 196 196 197 //! Returns the content of a file 198 std::string LuaState::getSourceCode(const std::string& filename) 199 { 200 shared_ptr<ResourceInfo> info = Resource::getInfo(filename); 201 if (info == NULL) 202 return ""; 203 else 204 return Resource::open(info)->getAsString(); 205 } 206 197 207 #if LUA_VERSION_NUM != 501 198 208 const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size) -
code/branches/gamestate/src/libraries/core/LuaState.h
r6442 r6626 80 80 void luaLog(unsigned int level, const std::string& message); // tolua_export 81 81 bool fileExists(const std::string& filename); // tolua_export 82 std::string getSourceCode(const std::string& filename); // tolua_export 82 83 83 84 const std::stringstream& getOutput() const { return output_; }
Note: See TracChangeset
for help on using the changeset viewer.