Changeset 6627 for code/branches/gamestate
- Timestamp:
- Mar 28, 2010, 7:45:40 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
r6626 r6627 140 140 // The '@' is a Lua convention to identify the chunk name as filename 141 141 chunkname = '@' + sourceFileInfo->filename; 142 143 // Also fill a map with the actual source code. This is just for the include* commands 144 // where the content of sourceFileInfo->filename doesn't match 'code' 145 this->sourceCodeMap_[sourceFileInfo->filename] = code; 142 146 } 143 147 else … … 174 178 // Load the old info again 175 179 sourceFileInfo_ = oldSourceFileInfo; 180 181 // Delete source code entry 182 if (sourceFileInfo != NULL) 183 this->sourceCodeMap_.erase(sourceFileInfo->filename); 176 184 } 177 185 … … 198 206 std::string LuaState::getSourceCode(const std::string& filename) 199 207 { 208 // Try the internal map first to get the actual Lua code 209 // and not just some pseudo Lua-XML code when using include* commands 210 std::map<std::string, std::string>::const_iterator it = this->sourceCodeMap_.find(filename); 211 if (it != this->sourceCodeMap_.end()) 212 return it->second; 200 213 shared_ptr<ResourceInfo> info = Resource::getInfo(filename); 201 214 if (info == NULL) -
code/branches/gamestate/src/libraries/core/LuaState.h
r6626 r6627 115 115 bool bIsRunning_; 116 116 shared_ptr<ResourceInfo> sourceFileInfo_; 117 std::map<std::string, std::string> sourceCodeMap_; 117 118 std::string (*includeParseFunction_)(const std::string&); 118 119
Note: See TracChangeset
for help on using the changeset viewer.