Hello, i’m trying to get random value from this table
local dogs = {"1269231654", "1269231654", "45447637"}
Soo far i tried:
local image = table[math.random(1, #dogs)]
however this returns nil
instead image ID.
Any other ideas?
Hello, i’m trying to get random value from this table
local dogs = {"1269231654", "1269231654", "45447637"}
Soo far i tried:
local image = table[math.random(1, #dogs)]
however this returns nil
instead image ID.
Any other ideas?
local image = table[math.random(1, #dogs)]
You need to used dogs as a table instead of an undefined value.
local dogs = {"1269231654", "1269231654", "45447637"}
local image = dogs[math.random(1, #dogs)] -- return one of the values from the dogs table
Thanks! It worked, sorry i’m kinda new to playing with tables.
It’s cool I think I also made the same mistake when I was new to coding lol. Anyways happy coding!