|
Peter Odding escribió:
No, I was using an example of luaL_loadbuffer as base for that code. I thought it was a function, not a macro.Roger D Vargas wrote:I was using luaL_loadbuffer to execute scripts loaded from a file, with good results, excepting that I couldnt use comments because all file was passed as a single line. So, i tried to change the code to use luaL_loadfile: if (filename.length() > 0) { int error = luaL_dofile(luaVM, filename.c_str()) || lua_pcall(luaVM, 0, 0, 0); if (error) { cout << lua_tostring(luaVM, -1) << endl; lua_pop(luaVM, 1); } } But this causes a lot of errors on script that worked perfectly with previous version. What am I doing wrong here?Are you aware that luaL_dofile() is defined as follows?
So, i guess the correct code is int error = luaL_dofile(luaVM, filename.c_str()) if (error) { cout << lua_tostring(luaVM, -1) << endl; lua_pop(luaVM, 1); } -- http://dsgp.blogspot.com | Linux, programación, juegos Have no place I can be since I found Serenity But you can’t take the sky from me______________________________________________ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por minuto. http://es.voice.yahoo.com