Reputation: 42
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.
Upvotes: 1
Views: 1940
Reputation: 80931
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.
Upvotes: 1