From 70e2df4f86cf4101a10c7e1f7a6ac5cc03992793 Mon Sep 17 00:00:00 2001 From: paramat Date: Sat, 29 Oct 2016 15:22:18 +0100 Subject: Lua voxelmanip: Add optional buffer param for 'get param2 data' Update lua_api.txt. --- src/script/lua_api/l_vmanip.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3