Advertisement
skypop

CC Command Inventory clear

Aug 1st, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. function clear(...)
  2.     assert(commands, "Require Command Computer")
  3.     local arg = {...}
  4.     local b, result = false, {}
  5.     for i=1,#arg,3 do
  6.         assert(
  7.             arg[i] and arg[i+1] and arg[i+2],
  8.             string.format(
  9.                 "Missing coordinate: clear(%s, %s, %s)",
  10.                 arg[i] and arg[i] or "<x>",
  11.                 arg[i+1] and arg[i+1] or "<y>",
  12.                 arg[i+2] and arg[i+2] or "<z>"
  13.             )
  14.         )
  15.         local r
  16.         b, r = commands.blockdata(arg[i], arg[i+1], arg[i+2], "{Items:[{}]}")
  17.         table.insert(result, unpack(r))
  18.         if not b then
  19.             return false, #result > 0 and result or nil
  20.         end
  21.     end
  22.     return b, #result > 0 and result or nil
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement