Changeset 1102
- Timestamp:
- Apr 17, 2008, 3:40:12 PM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/bin/levels/sample.oxw
r1089 r1102 38 38 39 39 40 < !--?lua40 <?lua 41 41 for i = 1, 226, 1 42 42 do ?> 43 <Model position="<?lua print(math.random(-19597, 18732))?>, <?lua print(math.random(-19597, 18732)) ?>, <?lua print(math.random(-19597, 18732)) ?>" scale="<?lua print(math.random( 20, 119)) ?>" mesh="ast<?lua print( i%6+ 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random(16, 44)) ?>" />43 <Model position="<?lua print(math.random(-19597, 18732))?>, <?lua print(math.random(-19597, 18732)) ?>, <?lua print(math.random(-19597, 18732)) ?>" scale="<?lua print(math.random( 20, 119)) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random(16, 44)) ?>" /> 44 44 <?lua 45 45 end 46 ? -->46 ?> -
code/trunk/src/core/Loader.cc
r1085 r1102 115 115 Script::init(Script::getLuaState()); 116 116 Script::run();*/ 117 //Script* lua = Script::getInstance();118 //lua->loadFile(level->getFile(), true);119 //lua->run();117 Script* lua = Script::getInstance(); 118 lua->loadFile(level->getFile(), true); 119 lua->run(); 120 120 121 121 try … … 124 124 COUT(3) << "Mask: " << Loader::currentMask_s << std::endl; 125 125 126 ticpp::Document xmlfile(level->getFile());127 xmlfile.LoadFile();126 //ticpp::Document xmlfile(level->getFile()); 127 //xmlfile.LoadFile(); 128 128 //ticpp::Element myelement(*Script::getFileString()); 129 //ticpp::Document xmlfile;130 xmlfile.ToDocument();131 //xmlfile.Parse(lua->getLuaOutput(), true);129 ticpp::Document xmlfile; 130 //xmlfile.ToDocument(); 131 xmlfile.Parse(lua->getLuaOutput(), true); 132 132 133 133 ticpp::Element rootElement; -
code/trunk/src/core/Script.cc
r1076 r1102 102 102 } 103 103 104 #if LUA_VERSION_NUM != 501 105 const char * Script::lua_Chunkreader(lua_State *L, void *data, size_t *size) 106 { 107 LoadS* ls = ((LoadS*)data); 108 if (ls->size == 0) return NULL; 109 *size = ls->size; 110 ls->size = 0; 111 return ls->s; 112 } 113 #endif 104 114 void Script::run() 105 115 { … … 110 120 error = luaL_loadstring(luaState_, init.c_str()); 111 121 #else 112 error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, (void*)init.c_str(), "init"); 122 LoadS ls; 123 ls.s = init.c_str(); 124 ls.size = init.size(); 125 error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, &ls, init.c_str()); 113 126 #endif 114 127 if (error == 0) -
code/trunk/src/core/Script.h
r1056 r1102 50 50 class _CoreExport Script // tolua_export 51 51 { // tolua_export 52 struct LoadS { 53 const char *s; 54 size_t size; 55 }; 56 52 57 public: 53 58 inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export … … 61 66 62 67 #if LUA_VERSION_NUM != 501 63 inline static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;};68 static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size); 64 69 #endif 65 70
Note: See TracChangeset
for help on using the changeset viewer.