Pass the filename to moonscript.loadstring for error reporting

This commit is contained in:
Thomas Goyne 2013-05-04 18:31:33 -07:00
parent 5dd982b742
commit 6e62f9e461
1 changed files with 2 additions and 1 deletions

View File

@ -57,6 +57,7 @@ namespace Automation4 {
if (luaL_dostring(L, "return require('moonscript').loadstring"))
return false; // Leaves error message on stack
lua_pushlstring(L, &buff[0], buff.size());
return lua_pcall(L, 1, 1, 0) == 0; // Leaves script or error message on stack
lua_pushstring(L, filename.string().c_str());
return lua_pcall(L, 2, 1, 0) == 0; // Leaves script or error message on stack
}
}