conlang-heonian/output_sizes.lua
2022-03-24 21:47:24 +01:00

31 lines
728 B
Lua

function adjustTableSizes(tbl)
local words_max_length = {1,1,1,1,1,1}
for i=1, #tbl do
local this_word = tbl[i][2]
for j=1, #this_word-1 do
local length = string.len(this_word[j])
if length + 1 > words_max_length[j+1] then
words_max_length[j+1] = length + 1
end
end
local length = string.len(convertToHeonian(this_word[1]))
if length + 1 > words_max_length[1] then
words_max_length[1] = length + 1
end
end
for i=1, #words do
for j=1, #words[i]-1 do
if j > 3 then break end
local times = words_max_length[j+1] - string.len(words[i][j])
while times > 0 do
words[i][j] = words[i][j] .. " "
times = times - 1
end
words[i][j] = words[i][j] .. " "
end
end
return tbl
end