Witness 87 Posted September 11, 2016 tipo eu tenho isso function dword() return { 100, 500, 1000, 6000, } end agora quero que isso print um valor aleratório da tabela alguem sabe como se faz? Share this post Link to post Share on other sites
'PACI 2,317 Posted September 11, 2016 function dword() local tbl = {100, 500, 1000, 6000} math.randomseed(os.time()) return tbl[math.random(#tbl)] end print(dword()) 1 Portugapt reacted to this Share this post Link to post Share on other sites
Witness 87 Posted September 11, 2016 function dword() local tbl = {100, 500, 1000, 6000} math.randomseed(os.time()) return tbl[math.random(#tbl)] end print(dword()) retorna sempre 6000 assim Share this post Link to post Share on other sites
Witness 87 Posted September 11, 2016 no meu tá sempre a returnar o mesmo valor http://prntscr.com/cgteki Share this post Link to post Share on other sites