33 posts
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
130 posts
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).
33 posts
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
7083 posts
Location
Tasmania (AU)
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
33 posts
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
3057 posts
Location
United States of America
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.
33 posts
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
3057 posts
Location
United States of America
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