I am currently making a OS with a GUI. What I would like to happen, is the GUI text is printed in the centre. Does anyone know how I would be-able to do this?
Centre Print
Started by koslas, Aug 06 2012 11:44 PM
3 replies to this topic
#1
Posted 06 August 2012 - 11:44 PM
#2
Posted 07 August 2012 - 01:21 AM
This Should do it
Then just Call it using
local function center(str) local width = term.getSize() local x,y = term.getCursorPos() term.setCursorPos((width-#str)/2,y) return str end
Then just Call it using
print(center(string here))
#3
Posted 07 August 2012 - 01:24 AM
ChiknNuggets, on 07 August 2012 - 01:21 AM, said:
<p>This Should do it </p>
<br />
<div><span>
<div> </div>
<div>Then just Call it using </div>
<div><span>
<div> </div>
<br />
<div><span>
</span> <div><span>local function center(str)</span></div> <div><span> local width = term.getSize()</span></div> <div><span> local x,y = term.getCursorPos()</span></div> <div><span> term.setCursorPos((width-#str)/2,y)</span></div> <div><span> return str</span></div> <div><span>end</span></div> <span></span></div>
<div> </div>
<div>Then just Call it using </div>
<div><span>
print(center(string here))</span></div>
<div> </div>
#4
Posted 07 August 2012 - 01:25 AM
i did not put in those span crap lol ill re type it
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











