Correctly report syntax errors in loaded scripts

Syntax errors were getting reported as "file not found" errors instead. Correctly pass through the right error code and message.
This commit is contained in:
Jason Perkins 2014-11-11 15:33:36 -05:00
parent b3aebffaf2
commit cfccb8fa61
2 changed files with 2 additions and 8 deletions

View File

@ -75,7 +75,7 @@ LUALIB_API int luaL_loadfile (lua_State* L, const char* filename)
if (z == OKAY) {
lua_pushcclosure(L, chunk_wrapper, 2);
}
else {
else if (z == LUA_YIELD) {
lua_pushstring(L, "cannot open ");
lua_pushstring(L, filename);
lua_pushstring(L, ": No such file or directory");

View File

@ -332,11 +332,5 @@ int premake_load_embedded_script(lua_State* L, const char* filename)
lua_concat(L, 2);
/* Load the chunk */
i = luaL_loadbuffer(L, chunk, strlen(chunk), filename);
if (i != OKAY) {
lua_pop(L, 1);
printf("Failed to load embedded script '%s': %s\n", filename, lua_tostring(L, -1));
}
return i;
return luaL_loadbuffer(L, chunk, strlen(chunk), filename);
}