but it would be easier to do it like this
string.rep("-",term.getWidth)
than to do it like
w,h = term.getSize()
string.rep("-",w)
Edited by ReBraLaCC, 22 September 2016 - 02:48 PM.
Posted 22 September 2016 - 02:47 PM
string.rep("-",term.getWidth)
w,h = term.getSize()
string.rep("-",w)
Edited by ReBraLaCC, 22 September 2016 - 02:48 PM.
Posted 22 September 2016 - 03:05 PM
local width = ({term.getSize()})[1]
local height = ({term.getSize()})[2]
However, that's not a very pleasant solution.string.rep("-", term.getSize())
will work, because that's the same as doing:string.rep("-", ({term.getSize()})[1], ({term.getSize()})[2]) --# third argument is ignored, since there's no parameter for it
Posted 22 September 2016 - 03:20 PM
local width, height = term.getSize() --# or local width = term.getSize() local _, height = term.getSize()
Posted 22 September 2016 - 03:48 PM
local width = (term.getSize()) -- Limits it to one value to get width local height = select(2, term.getSize()) -- Remove the 1st item in the vararg: so 51, 19 becomes 19.Though separate methods would be nicer.
Posted 22 September 2016 - 05:39 PM
Posted 22 September 2016 - 06:49 PM
Posted 22 September 2016 - 06:56 PM
Lyqyd, on 22 September 2016 - 06:49 PM, said:
0 members, 1 guests, 0 anonymous users