Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2026


Ignore:
Timestamp:
Oct 28, 2008, 3:06:23 PM (16 years ago)
Author:
landauf
Message:

lua include is now looking for files in the media directory

Location:
code/branches/objecthierarchy/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/core/LuaBind.cc

    r1961 r2026  
    123123      isRunning_ = true;
    124124      int error = 0;
    125       std::string init = "local scr = orxonox.LuaBind:getInstance()\nlocal debug = print\nprint = function(s)\nscr:luaPrint(s)\nend\ninclude = function(f)\nfile = io.open(f)\ncontent = file:read(\"*a\")\nfile:close()\nsource = scr:replaceLuaTags(content)\ndebug(source)\nassert(loadstring(source))()\nend\n";
     125      std::string init = "local scr = orxonox.LuaBind:getInstance()\nlocal debug = print\nprint = function(s)\nscr:luaPrint(s)\nend\ninclude = function(f)\nfile = assert(io.open(\"" + this->includePath_ + "\"..\"/\"..f))\ncontent = file:read(\"*a\")\nfile:close()\nsource = scr:replaceLuaTags(content)\nassert(loadstring(source))()\nend\n";
    126126      init += luaSource_;
    127127  #if LUA_VERSION_NUM == 501
  • code/branches/objecthierarchy/src/core/LuaBind.h

    r1959 r2026  
    7979    std::string replaceLuaTags(const std::string& text); // tolua_export
    8080
     81    inline void setIncludePath(const std::string& includepath)
     82        { this->includePath_ = includepath; }
     83
    8184    private:
    8285      LuaBind();
     
    8790      lua_State* luaState_;
    8891      bool isRunning_;
     92      std::string includePath_;
    8993
    9094  }; // tolua_export
  • code/branches/objecthierarchy/src/orxonox/Settings.cc

    r2011 r2026  
    3939#include "core/CoreIncludes.h"
    4040#include "core/ConfigValueIncludes.h"
     41#include "core/LuaBind.h"
    4142
    4243namespace orxonox
     
    8182            COUT(2) << "Warning: Data path set to \"/\", is that really correct?" << std::endl;
    8283        }
     84
     85        LuaBind::getInstance()->setIncludePath(this->dataPath_);
    8386    }
    8487
Note: See TracChangeset for help on using the changeset viewer.