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

Variable type question

Started by WesBur13, 03 November 2013 - 12:57 AM
WesBur13 #1
Posted 03 November 2013 - 01:57 AM
lets say that
m = 15
but i need it to be
m = "15"
how can i do that?
i cant just change the 15 because its a variable thanks!
Lyqyd #2
Posted 03 November 2013 - 02:13 AM
Split into new topic.

Are you looking for tostring()?
WesBur13 #3
Posted 03 November 2013 - 09:03 AM
Let me try this again
Here's the code
Peripheral.wrap("back")
Rednet.open("back")
M = turtle.getFuelLevel()
Rednet.send(6,M)
Print(M)

Ok so it sends perfect but it sends as
4567
Instead of
"4567"
How can I fix this?
OReezy #4
Posted 03 November 2013 - 09:15 AM
tostring() will convert things to a string.

ex:
x = 15
print(tostring(x))
WesBur13 #5
Posted 03 November 2013 - 09:53 AM
Ok so then how do I send the tostring via Rednet?
LBPHacker #6
Posted 03 November 2013 - 09:56 AM
Man, read the PIL.
rednet.send(6, tostring(M))
WesBur13 #7
Posted 03 November 2013 - 10:52 AM
Thanks I've been using lua for awhile but still not an expert at it! :)/>