aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-06-12 20:00:50 +0200
committerest31 <MTest31@outlook.com>2015-06-12 20:23:31 +0200
commit502e40a649137461947c36ea52205f058f81296f (patch)
treead61cb8833140aa1a255a8b460e57cf3ec5a765b /src/script/cpp_api
parent0b187ede4bd117d1163951b8eae744d2927da631 (diff)
downloadminetest-502e40a649137461947c36ea52205f058f81296f.tar.gz
minetest-502e40a649137461947c36ea52205f058f81296f.tar.bz2
minetest-502e40a649137461947c36ea52205f058f81296f.zip
dofile error reporting for syntax errors
According to doc, dofile() raises an error when parsing failed due to syntax errors. Fixes #2775
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r--src/script/cpp_api/s_security.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp
index c46483e95..6a6d40307 100644
--- a/src/script/cpp_api/s_security.cpp
+++ b/src/script/cpp_api/s_security.cpp
@@ -407,7 +407,8 @@ int ScriptApiSecurity::sl_g_dofile(lua_State *L)
{
int nret = sl_g_loadfile(L);
if (nret != 1) {
- return nret;
+ lua_error(L);
+ // code after this function isn't executed
}
int top_precall = lua_gettop(L);
lua_call(L, 0, LUA_MULTRET);