With a normal table, you could just do;
local t = {"red", "blue"}
print(math.random(1, #t))
and it will work. But in a dictionary, it doesn't.
local t = {red = 0, blue = 0}
print(math.random(1, #t)) -->bad argument #2 to 'random' (interval is empty)
Doing further tests shows that the table doesn't even have a length, which doesn't really make sense.
local t = {red = 0, blue = 0}
print(#t) --> 0
Of course, I could do something like:
local t = {red = 0, blue = 0}
local rand = math.random(1,2)
if rand == 1 then
print("red was chosen")
else
print("blue was chosen")
end
but this is really messy once the table gets any bigger.
Is there any way I can choose a random number from a dictionary efficiently?

3 comments
Or you could go 't[keys[math.random(1,#keys)]]' c:
Yes, but it's more illustrative of the point to give the values names
Gracias senor!