summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-06-27 22:33:31 -0400
committerkwolekr <kwolekr@minetest.net>2013-06-27 22:35:35 -0400
commit9e100bc42b5275299020ea8619e64f2e4aa76192 (patch)
tree0fddf53b5665ec41181f52548a7676efa10e2e83 /src/script/lua_api/l_vmanip.cpp
parent6b3169e4d0ebd82661d7cca9e3a381124a897f1a (diff)
downloadminetest-9e100bc42b5275299020ea8619e64f2e4aa76192.tar.gz
minetest-9e100bc42b5275299020ea8619e64f2e4aa76192.tar.bz2
minetest-9e100bc42b5275299020ea8619e64f2e4aa76192.zip
Apply various fixes to several things
Diffstat (limited to 'src/script/lua_api/l_vmanip.cpp')
-rw-r--r--src/script/lua_api/l_vmanip.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp
index f753f5f27..8bf65a555 100644
--- a/src/script/lua_api/l_vmanip.cpp
+++ b/src/script/lua_api/l_vmanip.cpp
@@ -88,7 +88,7 @@ int LuaVoxelManip::l_set_data(lua_State *L)
int volume = vm->m_area.getVolume();
for (int i = 0; i != volume; i++) {
lua_rawgeti(L, 2, i + 1);
- content_t c = lua_tonumber(L, -1);
+ content_t c = lua_tointeger(L, -1);
vm->m_data[i].setContent(c);
@@ -224,7 +224,11 @@ int LuaVoxelManip::create_object(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
- Map *map = &(get_scriptapi(L)->getEnv()->getMap());
+ Environment *env = get_scriptapi(L)->getEnv();
+ if (!env)
+ return 0;
+
+ Map *map = &(env->getMap());
LuaVoxelManip *o = new LuaVoxelManip(map);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;