This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mycale's profile picture

[Lua][Error] Expected string, number

Started by mycale, 17 January 2013 - 09:32 AM
mycale #1
Posted 17 January 2013 - 10:32 AM
Hello there everybody

I'm quite new to computercraft. Nice to meet everbody!

I can't figure out why part of my little program doesn't work and hope you could point me in the right direction.

while true do
term.clear()
term.setCursorPos(1, 1)
print ("Energy on")
local input=read()
if input == "yes" then
redstone.setBundledOutput(bottom, colors.white)
print ("Ok then")
else
print("I'll be waiting")
end
end

It crashes at the redstone.setBundledOutput part, where it tells me the error mentioned in the title. Any ideas what I left out?

Thanks in advance!
ChunLing #2
Posted 17 January 2013 - 10:33 AM
redstone.setBundledOutput("bottom", colors.white)

To clarify, you used the identifier of a nil variable, bottom, when you wanted the string "bottom".

And, I think this is a first for me :ph34r:/>
Edited on 17 January 2013 - 09:34 AM
mycale #3
Posted 17 January 2013 - 11:26 AM
Awesome, thanks! It works now. I see, I completely overlooked the brackets. Though I need to delve a bit more into lua before managing to wip up an item retrieval system :)/>

A first for what? Seeing this error?
ChunLing #4
Posted 17 January 2013 - 05:46 PM
Well, for being the first to spot/reply on an error of this nature in "ninja time", the first minutes after the thread is posted. Of course, it would have been more ninja-like if someone else had posted with the solution in the minutes after my post.
mycale #5
Posted 18 January 2013 - 08:09 AM
Woah, yeah, I did not look at the timestamp on the post. That was lightning fast indeed. :)/>
ChunLing #6
Posted 18 January 2013 - 11:47 AM
I've seen faster. But I doubt I've ever been faster personally.