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

remove spaces between strings?

Started by gergo654, 01 June 2016 - 01:44 PM
gergo654 #1
Posted 01 June 2016 - 03:44 PM
I am working on a "lua console faker" program and it reads what the user types in (local input = read() ) it does not print out the working
directory when you type in cd rom for example so I was wondering if I can like remove the spaces between the two strings.
Example:.
wdir = shell.dir()
print(wdir,">")
but the output is for example:
rom > .
i would like to print this like this:
rom>
Edited on 01 June 2016 - 02:06 PM
KingofGamesYami #2
Posted 01 June 2016 - 04:01 PM
Assuming you meant shell.dir (since fs.dir doesn't exist), I cannot reproduce your results.

http://imgur.com/1GxI4sU
gergo654 #3
Posted 01 June 2016 - 04:06 PM
thx i just fixed it :S
and idk why I typed in the same command and i got this:
http://imgur.com/gooIyFl
Edited on 01 June 2016 - 02:45 PM
MKlegoman357 #4
Posted 01 June 2016 - 10:29 PM
That's because in the latest CC versions print() was changed to add spaces between each argument. Just concatenate the strings to remove the space:


print(shell.dir() .. ">")
gergo654 #5
Posted 02 June 2016 - 05:03 PM
thank you :)/>