Skip to content

Instantly share code, notes, and snippets.

@witchica
Created September 13, 2015 13:28
Show Gist options
  • Save witchica/62e0707f672ad237a9b7 to your computer and use it in GitHub Desktop.
Save witchica/62e0707f672ad237a9b7 to your computer and use it in GitHub Desktop.
local component = require("component")
local hologram = component.hologram
function setVoxel(x, y, z, value)
local current = hologram.get(x, z)
local positiveMask = bit32.lshift(1, y - 1)
if value then
hologram.set(x, z, bit32.bor(current, positiveMask))
else
local negativeMask = bit32.bnot(positiveMask)
hologram.set(x, z, bit32.band(current, negativeMask))
end
end
local args = {...}
setVoxel(tonumber(args[1]), tonumber(args[2]), tonumber(args[3]), args[4] == "true" or args[4] == "on")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment