1

I was trying to get an hologram projector working, but in run into these errors:

bad arguments #3 (number expected, got no value)

My script is:

local component = require("component")
local hologram = component.hologram

function setVoxel(x, y, z, value)
  print(x)
  print(y)
  print(z)
  print(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 = {...}
print(args[1])
print(args[2])
print(args[3])
print(args[4])
setVoxel(tonumber(args[1]), tonumber(args[2]), tonumber(args[3]), args[4])

I used:

holo-set 8 16 20 true

The print commands returned:

8
16
20
true

but its not working. I have checked the spelling. Also the hologram is correctly initialized.

daurnimator
  • 4,091
  • 18
  • 34
F. Linnenberg
  • 42
  • 1
  • 4
  • What does "opencomputers" mean? There's no description, and this is the only question with that tag. (I presume "minecraft" is somehow relevant, but I don't see anything about it in the question.) – Keith Thompson Aug 09 '14 at 20:52
  • 1
    @KeithThompson I imagine (read: My best guess) opencomputers is the mod he is using to get computers in Minecraft. – TMH Aug 28 '14 at 10:50

1 Answers1

1

That error means some function (what's the rest of the error?) which expected to get three arguments only got two.

Given that code snippet the only function I can see to which that might apply is hologram.get.

Which, given a quick look at the documentation (thank you Google), does in fact appear to require three arguments.

get(x:number, y:number, z:number):number
Returns the value at the specified position.
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148