Name Generating Lua Script

I was on a car trip a while back and programmed this on my iPod. It took maybe an hour and a half, so it is VERY ugly but it does what I wanted it to do. Generate senseless names that sound like they are from some ancient Inca-related tribe. This was programmed in Lua.


nvowels = {"b","c","d","f","g","h","j","k","l","m","n","p","r","s","t","v","w","
x","y","z"} 
 
vowels = {"a","e","i","o","u"} 
 
cho = math.random(5,7) 
local name = {"b","c","d","f","g","h","j"} 
 
function getBoolBasedLetter() 
if getBool() then 
return getVowel() 
else 
return getNVowel() 
end 
end 
 
function setLetters() 
if getBool() then 
name[1] = getVowel() 
else 
name[1] = getNVowel() 
end 
it = 2 
while it <= cho do 
if isVowel(name[it - 1]) then 
name[it] = getNVowel() 
else 
name[it] = getVowel() 
end 
name[it + 1] = getBoolBasedLetter() 
if name[it] == "u" and name[it + 1] == "i" then 
name[it] = getBoolBasedLetter() 
end 
it = it + 2 
end 
if name[cho] == "q" then 
name[cho] = getMNVowel("q") 
end 
rand = math.random(1,12) 
if rand == 10 then 
name[1] = "c" 
name[2] = "h" 
end 
if isVowel(name[3]) then 
else 
name[3] = getVowel() 
if rand == 9 then 
name[1] = "s" 
name[2] = "t" 
name[3] = getVowel() 
end 
rand = math.random(1,12) 
if rand == 6 then 
name[cho] = "r" 
name[cho - 1] = "o" 
end 
if isNVowel(name[cho]) and isNVowel(name[cho - 1]) then 
name[cho - 1] = getVowel() 
end 
end 
end 
 
 
 
 
function getVowel() 
return vowels[math.random(1,5)] 
end 
 
function isVowel(n) 
if n == "a" or n == "e" or n == "i" or n == "o" or n == "u" then 
return true 
else 
return false 
end 
end 
 
function isNVowel(n) 
if n == "a" or n == "e" or n == "i" or n == "o" or n == "u" then 
return false 
else 
return true 
end 
end 
 
function getMVowel(n) 
re = getVowel() 
while re == n do 
re = getVowel() 
end 
return re 
end 
 
function getMNVowel(n) 
re = getNVowel() 
while re == n do 
re = getNVowel() 
end 
return re 
end 
 
function getNVowel() 
return nvowels[math.random(1,20)] 
end 
 
function getBool() 
if math.random(1,2) == 1 then 
return true 
else 
return false 
end 
end 
 
setLetters() 
 
local endName = name 
 
iter = 1 
while iter <= cho do 
if iter == 1 then 
name[iter] = name[iter].upper(name[iter]) 
end 
io.write(name[iter]) 
iter = iter + 1 
end 
print() 

And here are some of the outputs of:

Foouci
Emozo
Kaemyeu
Umuuj
Veene
Azofiga
Moabwai
Eyepo
Iwior
Chilto
Steua
Emocnoa

I honestly had no idea how other name generating scripts did it so I just kind of hard coded the whole thing into an ugly beast. Maybe other ones somehow use Perlin noise somehow?