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

Problems with monitors

Started by astonish01, 30 April 2015 - 01:54 AM
astonish01 #1
Posted 30 April 2015 - 03:54 AM
I have been trying to make a "x" information on a monitor, but when it appears in the monitor, it doesn't appear completely, for example:

term.write("long textttttttttttttttttttttttttttttttttttttttttt")
__________________________
|long textttttttttttttttttttttttttttttttttttttttttt
|
|
|
|
|__________________________|

instead of doing this:
__________________________
|long texttttttttttttttttttttttttttttt
|ttttttttttttt
|
|
|
|
|__________________________|


This is the code, if it will help in any ways: http://pastebin.com/xCVdQVFc
CoderPuppy #2
Posted 30 April 2015 - 04:18 AM
The monitor itself doesn't do any text wrapping (term.whatever gets passed directly to the redirect), that's handled by write (which is called by print). So just use write or print and the text should wrap (though it's based on words).
astonish01 #3
Posted 30 April 2015 - 04:24 AM
The monitor itself doesn't do any text wrapping (term.whatever gets passed directly to the redirect), that's handled by write (which is called by print). So just use write or print and the text should wrap (though it's based on words).

LIke

term.redirect("place")
term.setCursorPos(1,1)
write/print(function)

or simply

peripheral.wrap(place)
write(function)

?

EDIT: I tried "write"and it said: "bios:166: bad argument: string expected, got table"

and when i tried with "print"

it said: "table: xxxxxxxx" (x=random number/letter)
Edited on 30 April 2015 - 02:28 AM
Bomb Bloke #4
Posted 30 April 2015 - 09:35 AM
You could try using textutils.tabulate() instead of print(), but depending on what's actually in that table of yours, it may or may not come out as you want.

http://lua-users.org/wiki/TablesTutorial
astonish01 #5
Posted 30 April 2015 - 07:45 PM
You could try using textutils.tabulate() instead of print(), but depending on what's actually in that table of yours, it may or may not come out as you want.

http://lua-users.org.../TablesTutorial

The thing is, I'm trying to display a "x" function, example:

x = getInfo
print(x)

END OF EXAMPLE

then it prints "table: xxxxxxxx" instead of displaying the info.

EDIT: Even with tabulate, the text still goes off the monitor screen.
Edited on 30 April 2015 - 05:57 PM
KingofGamesYami #6
Posted 30 April 2015 - 09:50 PM
if you were printing a function, it would print "function: xxxxxx", not "table: xxxxxx". Because it is printing "table: xxxxxx", that means you are trying to print a table.

If you have a lot of text, you can always serialize the table and save it to a file, as long as it doesn't contain functions.
astonish01 #7
Posted 01 May 2015 - 12:55 AM
if you were printing a function, it would print "function: xxxxxx", not "table: xxxxxx". Because it is printing "table: xxxxxx", that means you are trying to print a table.

If you have a lot of text, you can always serialize the table and save it to a file, as long as it doesn't contain functions.

Thanks for telling me the difference, but what do you mean with serialize, I'm not that into programming, and also, it contains another table inside the table:

example = peripheral.wrap
example2 = example.peripheralstuff
KingofGamesYami #8
Posted 01 May 2015 - 01:10 AM
I was referring to textutils.serialize, which changes various data types to strings, which can then be written to a file using fs.
Edited on 30 April 2015 - 11:10 PM