aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-11-25 00:03:03 +0100
committersapier <Sapier at GMX dot net>2013-11-25 00:04:05 +0100
commit4f246f0e2278aa677a74c631b25e760e8a197a3f (patch)
tree77ff881587405e7611efdcd09b092b532d6b1140 /src/script
parentf87c1c2410d80ae42171bc32d04d55906a7aa1c4 (diff)
downloadminetest-4f246f0e2278aa677a74c631b25e760e8a197a3f.tar.gz
minetest-4f246f0e2278aa677a74c631b25e760e8a197a3f.tar.bz2
minetest-4f246f0e2278aa677a74c631b25e760e8a197a3f.zip
Fix line_of_sight (AGAIN)
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_env.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 9bed23d47..76e8c6907 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -39,7 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define GET_ENV_PTR ServerEnvironment* env = \
dynamic_cast<ServerEnvironment*>(getEnv(L)); \
if( env == NULL) return 0
-
+
///////////////////////////////////////////////////////////////////////////////
@@ -632,7 +632,7 @@ int ModApiEnvMod::l_get_voxel_manip(lua_State *L)
Map *map = &(env->getMap());
LuaVoxelManip *o = new LuaVoxelManip(map);
-
+
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, "VoxelManip");
lua_setmetatable(L, -2);
@@ -660,10 +660,12 @@ int ModApiEnvMod::l_line_of_sight(lua_State *L) {
// read position 2 from lua
v3f pos2 = checkFloatPos(L, 2);
//read step size from lua
- if (lua_isnumber(L, 3))
+ if (lua_isnumber(L, 3)) {
stepsize = lua_tonumber(L, 3);
+ }
- return (env->line_of_sight(pos1,pos2,stepsize));
+ lua_pushboolean(L, env->line_of_sight(pos1,pos2,stepsize));
+ return 1;
}
// minetest.find_path(pos1, pos2, searchdistance,