So I have a module to choose names for a building. I thought of having a system like so:
local buildingTypes = {
["Corporation"] = {[1] = {"Some stuff here"}, [2] = {"Some stuff here"}},
["Shop"] = {[1] = {"Some stuff here"}, [2] = {"Some stuff here"}},
["Food"] = {[1] = {"Some stuff here"}, [2] = {"Some stuff here"}},
["Utility"] = {[1] = {"Some stuff here"}, [2] = {"Some stuff here"}}
}
function buildings:ChooseName()
local buildingType = buildingTypes[math.random(1, #buildingTypes)] -- ERROR LINE
local word1 = buildingType[1][math.random(1, #buildingType[1])]
local word1 = buildingType[2][math.random(1, #buildingType[2])]
local name = "%s %s"
for i = 1, 2, 1 do
name:Format(name, i, buildings[buildingType..i[math.random(1, #buildings.buildingType..i)]])
end
return(name)
end
It errors saying that "bad argument #2 to 'random' (interval is empty)"

1 comment
Also, don't worry about the "Some stuff here", I assure you-- those tables are more than filled up XD