Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Box = {}
- Box.new = function(y, width, height, borderChar, text)
- local self = {}
- width = width or 5
- height = height or 5
- borderChar = borderChar or '*'
- self.draw = function()
- cPrint(y, string.rep(borderChar, width))
- for i=1, height-2 do
- cPrint(y+1, borderChar..string.rep(" ", width-2)..borderChar)
- y = y +1
- if i == (height-2)/2 then
- cPrint(y, " "..string.rep(" ", (width/2)-string.len(text))..text..string.rep(" ", (width/2)-string.len(text)).." ")
- end
- end
- cPrint(y, string.rep(borderChar, width))
- end
- return self
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement