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

disk.Set

Started by RickJ, 04 February 2016 - 08:14 PM
RickJ #1
Posted 04 February 2016 - 09:14 PM
Hello,

So I'm creating a banking system in Computercraft and I have the following problem.

I'm trying to set a label of a Disk to a variable which is done like the following

idLength = #id
count = idLength +1
print("The latest ID ="..idLength..", So we're creating ID:"..count.."for you!")
disk.setLabel("bottom", count)

and I get the following error since I've put in a variable instead of a string.

disk:22: Expected string

Which would mean that I'm only able to set the label of a disk to a pre defined string…
But the point is that when I create an account I check my id array to see what the latest ID is.
and it would add a number to it and use that as an ID.

Please help me out…

Thanks in advance,
Rick
Lyqyd #2
Posted 04 February 2016 - 10:18 PM
It wants a string, but you're passing it a number. Convert your number to a string with the tostring function.
wilcomega #3
Posted 05 February 2016 - 01:42 PM

count = tostring(idLength +1)
Edited on 05 February 2016 - 12:42 PM