Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 28, 2010, 7:45:40 PM (15 years ago)
Author:
rgrieder
Message:

Added Lua debugging support for XML embedded Lua code (even steps into 'include' calls).
The debugger will simply display the output of the Lua tag parser.
Just write 'pause(message)' within a Lua tag and the debugger will be called.

Location:
code/branches/gamestate/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/src/libraries/core/LuaState.cc

    r6626 r6627  
    140140            // The '@' is a Lua convention to identify the chunk name as filename
    141141            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;
    142146        }
    143147        else
     
    174178        // Load the old info again
    175179        sourceFileInfo_ = oldSourceFileInfo;
     180
     181        // Delete source code entry
     182        if (sourceFileInfo != NULL)
     183            this->sourceCodeMap_.erase(sourceFileInfo->filename);
    176184    }
    177185
     
    198206    std::string LuaState::getSourceCode(const std::string& filename)
    199207    {
     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;
    200213        shared_ptr<ResourceInfo> info = Resource::getInfo(filename);
    201214        if (info == NULL)
  • code/branches/gamestate/src/libraries/core/LuaState.h

    r6626 r6627  
    115115        bool bIsRunning_;
    116116        shared_ptr<ResourceInfo> sourceFileInfo_;
     117        std::map<std::string, std::string> sourceCodeMap_;
    117118        std::string (*includeParseFunction_)(const std::string&);
    118119
Note: See TracChangeset for help on using the changeset viewer.