Pushok icon

wedge-shaped table

Pushok | PRO | 05/01/13 11:41:36 AM UTC | 0 ⭐ | 370 👁️ | Never ⏰ | []
Lua |

640 B

|

None

|

0 👍

/

0 👎

math.randomseed(os.time())
math.random()
 
tblHeight = 8
step = 1
maxWidth = 80
strLen = 2
 
symPairs = {}
 
for i = 1, tblHeight do
    symPairs[i] = {}
    for j = 1, 2 do
        local str = ''
        for k = 1, strLen do
            str = str..string.char(math.random(0x61, 0x7A))
        end
        symPairs[i][j] = str
    end
end
 
for i = 1, tblHeight do
    local line = ''
    local half = math.floor(maxWidth / 2) - strLen
    line = line..string.rep(' ', half - step * i - 1)
    line = line..symPairs[i][1]
    line = line..string.rep(' ', step * i)
    line = line..i
    line = line..string.rep(' ', step * i)
    line = line..symPairs[i][2]
    print(line..'\n')
end
io.read()

Comments