diff options
author | paramat <mat.gregory@virginmedia.com> | 2016-10-29 15:22:18 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2016-10-31 10:59:38 +0000 |
commit | 70e2df4f86cf4101a10c7e1f7a6ac5cc03992793 (patch) | |
tree | 43ebeb027beda84fe29047cff64edf4ef4754931 /src | |
parent | 380a4b6d60c3269d1d9c79c122ff5259989decd7 (diff) | |
download | minetest-70e2df4f86cf4101a10c7e1f7a6ac5cc03992793.tar.gz minetest-70e2df4f86cf4101a10c7e1f7a6ac5cc03992793.tar.bz2 minetest-70e2df4f86cf4101a10c7e1f7a6ac5cc03992793.zip |
Lua voxelmanip: Add optional buffer param for 'get param2 data'
Update lua_api.txt.
Diffstat (limited to 'src')
-rw-r--r-- | src/script/lua_api/l_vmanip.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp index 0d8123acd..bdf720f0a 100644 --- a/src/script/lua_api/l_vmanip.cpp +++ b/src/script/lua_api/l_vmanip.cpp @@ -277,11 +277,17 @@ int LuaVoxelManip::l_get_param2_data(lua_State *L) NO_MAP_LOCK_REQUIRED; LuaVoxelManip *o = checkobject(L, 1); + bool use_buffer = lua_istable(L, 2); + MMVManip *vm = o->vm; u32 volume = vm->m_area.getVolume(); - lua_newtable(L); + if (use_buffer) + lua_pushvalue(L, 2); + else + lua_newtable(L); + for (u32 i = 0; i != volume; i++) { lua_Integer param2 = vm->m_data[i].param2; lua_pushinteger(L, param2); |