   Using php instead of lua
  Does anyone tried php instead of Lua for engine scripting ? Is it easy to use and more benefical ??   
  The Lua interpreter has a smaller memory footprint than the php interpreter and is pretty fast. Php is not that fast (although it has ok performance) and it's a bit bloated.Now, you are perfectly free to test php scripting within your game. I'm not aware of anyone who did that but it might work.   ;  on a related note, I'm considering going the other way; building a framework around Lua for web developement as my host has Lua5.1 installed [grin]   ;  The main reason why I'm planning to leave Lua it's its awfull ability to debug... I merely have usefull debug infos. Here's my lua error handler, maybe some one could help me...// Gestionnaire d'erreur de luaint cScriptManager::LuaErrorHandler(lua_State* lua){lua_Debug d;lua_getstack(lua, 1, &d);lua_getinfo(lua, "Sln", &d);string err = lua_tostring(lua, -1);lua_pop(lua, 1);stringstream msg;msg << d.short_src << ":" << d.currentline;if (d.name != 0){msg << "(" << d.namewhat << " " << d.name << ")";}msg << " " << err << endl;cout << "!Panic : " << msg.str();lua_pushstring(lua, msg.str().c_str());return 1;}// Retourne la derniere erreur de Luaconst char * cScriptManager::GetLastError(void){lua_Debug d;if (lua_getstack(Lua, 1, &d) == 0){Error = "Stack depth problem when getting debug infos...";}else{lua_getinfo(Lua, "Sln", &d);string err = lua_tostring(Lua, -1);lua_pop(Lua, 1);stringstream msg;msg << d.short_src << ":" << d.currentline;if (d.name != 0){msg << "(" << d.namewhat << " " << d.name << ")";}msg << " " << err << endl;Error = msg.str();}return Error.c_str();};  wht do you mean by 'awfull ability to debug'? What is it you want to be able to do?   ;  An example :--!Panic : [C]:-1(method Hit) no overload of  'cRect:Hit' matched the arguments (const cRect, const cRect)candidates are:cRect:Hit(const cRect&)Lua : Runtime error !   ->Stack depth problem when getting debug infos...--Right now I have the exact description of the error, but many times I only have--Lua : Runtime error !   ->Stack depth problem when getting debug infos...--Another example :In a "if ... then ... end", I ommited then final "end". Here's the error : --Lua : syntax error during pre-compilation on "pong.lua"   ->Stack depth problem when getting debug infos...--I don't even have the line number or more description...;  Two things;1) how are you calling the code you want to get the error messages from?2) why are you using a stack depth position of '1' instead of '0' to get the current function which caused the error?I've just dumpped your code into my own test app as a error function and I can extract the first level of a stack trace fine.I'm calling it thusly;lua_pushcfunction(L,errorMsg);int loadrtn = luaL_loadfile(L, "startup.lua");if(lua_pcall(L, 0, 0, -2) != 0){const char * temp = luaL_checkstring(L,-1);std::cout << temp << std::endl;system("pause");}and if I feed it a lua file withrequire "engine"require "hellokitty"-- other codewhere 'engine' exists and 'hellokitty' doesn't, I get back;Quote:[C]:-1 startup.lua:2: module 'hellokitty' not found:   no field package.preload['hellokitty']   no file '.\hellokitty.lua'   no file 'r:\My Documents\Visual Studio 2005\Projects\Bonsai Engine\release\lua\hellokitty.lua'   no file 'r:\My Documents\Visual Studio 2005\Projects\Bonsai Engine\release\lua\hellokitty\init.lua'   no file 'r:\My Documents\Visual Studio 2005\Projects\Bonsai Engine\release\hellokitty.lua'   no file 'r:\My Documents\Visual Studio 2005\Projects\Bonsai Engine\release\hellokitty\init.lua'   no file '.\hellokitty.dll'   no file 'r:\My Documents\Visual Studio 2005\Projects\Bonsai Engine\release\hellokitty.dll'   no file 'r:\My Documents\Visual Studio 2005\Projects\Bonsai Engine\release\loadall.dll'Press any key to continue . . .Note; this is with lua_getstack(lua, 0, &d);, I found that with lua_getstack(lua, 1, &d); it blew up on the next line.As for getting where a compliation error occured, the only way I know of doing that is to check the return value from a function such as luaL_loadfile and it's != 0 then print out the error string.That said, I've only been looking into the debugging stuff for the last 20mins or so so I might have missed something wrt getting back more information about compile time errors [smile]   ;  As You said, i modified my code like that :...if (lua_getstack(Lua, -1, &d) == 0)...I use a stack position of '-1' and now I got the following error code :Lua : syntax error during pre-compilation on "pong.lua"   ->(tail call):-1( ) pong.lua:230: 'end' expected (to close 'function' at line 45) near '<eof>'which is far better now :) Thanks for this one.Now, here's how I call lua functions from C++ ://// Lance une fonction//bool cScriptManager::Call(const char *func, const char *msg){SetGlobal("msg", msg);return call_function<bool>(Lua, func);}func => Function's name in luamsg => the message to pass to the function (like WinProc in win32)   ;  if you adjust it to a loop then you can get a proper call stack, you might need to adjust which information gets returned at what level however as it can be a bit verbose after a while [grin]int errorMsg(lua_State *lua){lua_Debug d;int depth = -1;std::stringstream msg;std::string err = lua_tostring(lua, -1);lua_pop(lua, 1);while(lua_getstack(lua, depth, &d) != 0){lua_getinfo(lua, "Sln", &d);msg << d.short_src << ":" << d.currentline;if (d.name != 0){msg << "(" << d.namewhat << " " << d.name << ")";}msg << " " << err << "\n" << std::endl;depth++;}lua_pushstring(lua, msg.str().c_str());return 1;};  Ok,thanks for this piece fo code, I fell a litlle better with lua now :)   