how to select a random value in a json array lua

Solutions on MaxInterview for how to select a random value in a json array lua by the best coders in the world

showing results for - "how to select a random value in a json array lua"
Samir
20 Apr 2017
1local open = io.open("array.json", "r")
2local string = open:read("a")
3local array = json.decode(string)
4open:close()
5local msg = array[math.random(1, #array)]