My goal is to pick out a random item from a table in Lua.
This is what I\'ve got so far, but it currently does not work:
local myTable = { \'a\', \'b\',
I personally use the following function inspired by @ahmadh
function random_elem(tb) local keys = {} for k in pairs(tb) do table.insert(keys, k) end return tb[keys[math.random(#keys)]] end