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

How to print \ in Lua

Started by houseofkraft, 11 December 2016 - 03:41 PM
houseofkraft #1
Posted 11 December 2016 - 04:41 PM
So i am making some kind of loading animation and i want to print \

but i know \ means something special in Lua and it does not work.

Thanks

- House
H4X0RZ #2
Posted 11 December 2016 - 04:49 PM
Just escape \ in the string:

print "Here you go -> \\"

This is used for some other stuff too. eg linebreaks:

print "line 1\nline2"
(Although I'm not sure if print implemented that)
Edited on 11 December 2016 - 03:50 PM
houseofkraft #3
Posted 14 December 2016 - 12:10 PM
Thanks.