Lua choose random item from table
Posted
by Zen
on Stack Overflow
See other posts from Stack Overflow
or by Zen
Published on 2010-06-07T09:15:34Z
Indexed on
2010/06/07
9:32 UTC
Read the original article
Hit count: 173
lua
Seems easy but I just don't get any further:
Take this example:
local myTable = { 'a', 'b', 'c', 'd' }
print( myTable[ math.random( 0, #myTable - 1 ) ] )
- Why doesn't it work?
Google seems to have no answers on this either
© Stack Overflow or respective owner