--#note: minx/maxx/miny/maxy are coords defining the space
local lines = { [1]=""}
for word in text:gmatch( "%S+" ) do
local oldLine = lines[ #lines ]
lines[ #lines ] = lines[ #lines ] .. " " .. word
if #lines[ #lines ] > maxx - minx then
lines[ #lines ] = oldLine
lines[ #lines + 1 ] = word
end
end
The above works, however the first line is offset by one space...Below does not have the offset, however none of the words are spaced. (edit: actually, the first line is spaced. The rest are not)
local lines = { [1]=""}
for word in text:gmatch( "%S+" ) do
local oldLine = lines[ #lines ]
lines[ #lines ] = lines[ #lines ] .. word .. " "
if #lines[ #lines ] > maxx - minx then
lines[ #lines ] = oldLine
lines[ #lines + 1 ] = word
end
end
It could be the fact that I'm using mimic, however I have not run into any similar issues with it.
Additionally, the code I use to render it is here, if that makes any difference:
local l = self.miny for _, line in ipairs( self.lines ) do term.setCursorPos( self.minx, l ) term.write( line ) l = l + 1 end
Edited by KingofGamesYami, 01 September 2014 - 03:40 AM.











