Posted 16 October 2012 - 08:40 AM
Hello all,
What I want to do here is print out a header to a menu
output should be something like this:
======== Header ========
======== Middle =========
but it throws an exception at the first for loop in the printHead(str) function
! attempt to compare nil with number
any help would be greatly appreciated :D/>/> thanks in advance
its probably a silly mistake too ^^
What I want to do here is print out a header to a menu
output should be something like this:
======== Header ========
======== Middle =========
but it throws an exception at the first for loop in the printHead(str) function
! attempt to compare nil with number
any help would be greatly appreciated :D/>/> thanks in advance
its probably a silly mistake too ^^
local w = 20
function menu()
term.clear()
print( printHead("Header"))
print( printHead("Middle"))
end
function printHead(str)
str2 = ""
side = w/2 - #str/2
for i = 1, i > side do
str2 = str2 + "="
end
str2 = str2 + " "..str.." "
for i = 1, i > side do
str2 = str2 + "="
end
return str2
end
menu()