Converting the integers to their equivalent string representations
After a bit of dabbling with the script, I've updated the line #42 to #53 with a table iterator:

for _, ext in ipairs(bases) do
    if n &gt; ext[1] then
        table.insert( str, NumberToString(n / ext[1])..ext[2] )
        n = n % ext[1]
    end
end


where, bases has been redefined as:

{
    { 10^12, ' trillion' },
    { 10^9, ' billion' },
    { 10^6, ' million' },
    { 10^3, ' thousand' },
    { 10^2, ' hundred' },
}


that is, in descending orders of powers of 10.

I'd welcome other suggestions as well.