summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2016-11-24 10:10:20 -0500
committerShadowNinja <shadowninja@minetest.net>2016-11-24 10:10:20 -0500
commit3af5eef96463510a27cf06b9c3ecc9f1d04cdac6 (patch)
tree09482db230d50fab85fea20440f210c41c5361cd
parent9e10f9f49a558050d36a49db619bf8f5eb3853c0 (diff)
downloadminetest-3af5eef96463510a27cf06b9c3ecc9f1d04cdac6.tar.gz
minetest-3af5eef96463510a27cf06b9c3ecc9f1d04cdac6.tar.bz2
minetest-3af5eef96463510a27cf06b9c3ecc9f1d04cdac6.zip
Fix secure io.lines
It used to drop all of the return values from the insecure version of the function.
-rw-r--r--src/script/cpp_api/s_security.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp
index 5a64c249c..c9816f89b 100644
--- a/src/script/cpp_api/s_security.cpp
+++ b/src/script/cpp_api/s_security.cpp
@@ -577,13 +577,13 @@ int ScriptApiSecurity::sl_io_lines(lua_State *L)
CHECK_SECURE_PATH(L, path);
}
+ int top_precall = lua_gettop(L);
push_original(L, "io", "lines");
lua_pushvalue(L, 1);
- int top_precall = lua_gettop(L);
lua_call(L, 1, LUA_MULTRET);
// Return number of arguments returned by the function,
// adjusting for the function being poped.
- return lua_gettop(L) - (top_precall - 1);
+ return lua_gettop(L) - top_precall;
}