Jump to content




Unexpected behaviour \t


  • You cannot reply to this topic
4 replies to this topic

#1 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 26 March 2013 - 01:52 AM

Hello,

I dont know if this like this in LUA or just a bug in CC. So I ask you pro's if this isnt a bug or if its standard.

Test code:
print( "x\tx" ) --> outputs "x x"
Shouldnt this out put something like: "x x" (much or less then 5 spaces)

Big test code, wasnt it?

But maybe this doesnt even exist in LUA, maybe im mixing up Java and LUA again.. :/

Thanks for reading,

Engineer

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 26 March 2013 - 01:54 AM

there is no way to display tab atm so \t is replaced with a space

#3 Alekso56

  • Members
  • 62 posts

Posted 26 March 2013 - 01:56 AM

From the LUA manual: (just in case) (TheOriginalBIT already answered the question)

Literal strings can be delimited by matching single or double quotes, and can contain the following C-like escape sequences:
  • \a --- bell
  • \b --- backspace
  • \f --- form feed
  • \n --- newline
  • \r --- carriage return
  • \t --- horizontal tab --space instead
  • \v --- vertical tab -- space instead
  • \\ --- backslash
  • \" --- quotation mark
  • \' --- apostrophe
  • \[ --- left square bracket
  • \] --- right square bracket


#4 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 26 March 2013 - 02:02 AM

View PostTheOriginalBIT, on 26 March 2013 - 01:54 AM, said:

there is no way to display tab atm so \t is replaced with a space
Darn! Too bad it isnt implemented. I like the feature of /t because you can nicely make columns of text.
Than I need to use something like this.. I guess..
local t = {'s','o','m','e','t','h','i', 'n', 'g'}
local x = {'i','d','e','m'}

write( "X:  T:" )
for i = 1, #t do
   term.setCursorPos( 5, i + 1 )
   write( t[i] )
end

for i = 1, #x do
   term.setCursorPos( 1, i + 1 )
   write( x[i] )
end

It'll work.


View PostAlekso56, on 26 March 2013 - 01:56 AM, said:

From the LUA manual: (just in case) (TheOriginalBIT already answered the question)

Literal strings can be delimited by matching single or double quotes, and can contain the following C-like escape sequences:
  • \a --- bell
  • \b --- backspace
  • \f --- form feed
  • \n --- newline
  • \r --- carriage return
  • \t --- horizontal tab --space instead
  • \v --- vertical tab -- space instead
  • \\ --- backslash
  • \" --- quotation mark
  • \' --- apostrophe
  • \[ --- left square bracket
  • \] --- right square bracket

Thanks man, I couldnt find anything about this on the webs!
And also thanks BIT :P

#5 dissy

  • Members
  • 181 posts

Posted 26 March 2013 - 11:06 AM

View PostEngineer, on 26 March 2013 - 02:02 AM, said:

Darn! Too bad it isnt implemented. I like the feature of /t because you can nicely make columns of text.

Check out textutils.tabulate for an alternative way





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users