Changeset 1204
- Timestamp:
- 03/04/2010 01:21:04 PM (6 months ago)
- Location:
- Trunk/src/LuaEngine
- Files:
-
- 3 modified
-
GlobalFunctions.h (modified) (2 diffs)
-
LUAEngine.cpp (modified) (2 diffs)
-
UnitFunctions.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Trunk/src/LuaEngine/GlobalFunctions.h
r1191 r1204 605 605 return 1; 606 606 } 607 int GetPlatform(lua_State * L) 608 { 609 #ifdef WIN32 610 lua_pushliteral(L,"windows"); 611 #else 612 lua_pushliteral(L,"linux"); 613 #endif 614 return 1; 615 } 607 616 } 608 617 void RegisterGlobalFunctions(lua_State *L) … … 646 655 lua_register(L, "HasTimedEventWithName", &luaGlobalFunctions::HasTimedEventWithName); 647 656 lua_register(L, "HasTimedEvent", &luaGlobalFunctions::HasTimedEvent); 657 lua_register(L,"GetPlatform",&luaGlobalFunctions::GetPlatform); 648 658 } 649 659 #endif -
Trunk/src/LuaEngine/LUAEngine.cpp
r1203 r1204 241 241 lua_rawgeti(lu,LUA_REGISTRYINDEX,fReference); 242 242 if(!lua_isfunction(lu,-1) ) 243 luaL_error(lu,"Attempted to call aninvalid function. \n");243 luaL_error(lu,"Attempted to call invalid function. \n"); 244 244 } 245 245 } … … 247 247 { 248 248 bool ret = true; 249 if(lua_pcall(lu,params,res,0) ) 250 { 251 report(lu); 249 int top = lua_gettop(lu); 250 if(strcmp(luaL_typename(lu,top-params),"function") ) 252 251 ret = false; 252 else 253 { 254 if(lua_pcall(lu,params,res,0) ) 255 { 256 report(lu); 257 ret = false; 258 } 253 259 } 254 260 return ret; -
Trunk/src/LuaEngine/UnitFunctions.h
r1199 r1204 573 573 uint16 functionRef = 0; 574 574 lua_settop(L,1); 575 if( typeName == "function")575 if(!strcmp(typeName,"function")) 576 576 functionRef = (uint16)lua_ref(L,true); 577 else if( typeName == "string")577 else if(!strcmp(typeName,"string")) 578 578 { 579 579 const char * functionName = luaL_checkstring(L,1);
![(please configure the [header_logo] section in trac.ini)](/trac/arcscripts/chrome/site/your_project_logo.png)