Search
 
SCRIPT & CODE EXAMPLE
 

LUA

how to choose a random item from a table lua

local myTable = {"Hello", "World", "Lua"}

print(myTable[1]) --Outputs: "Hello"
print(#myTable) --Outputs: 3 because we have 3 values in our table
print(myTable[math.random(1, #myTable)]) --Outputs a random value in our table!
Comment

PREVIOUS NEXT
Code Example
Lua :: lua math floor 
Lua :: roblox lua random number 
Lua :: lua click detection 
Lua :: roblox player joined 
Lua :: luau how to make a kill brick 
Lua :: open popup windows lua 
Lua :: roblox how to tween part color 
Lua :: how to detect if part had children roblox 
Lua :: roblox studio Teleport service not working 
Lua :: roblox random brick colour 
Lua :: lua roblox global variables 
Lua :: lua add 1 to a variable 
Lua :: what does local mean in roblox 
Lua :: lua game code 
Lua :: table.find lua 
Lua :: how to kill humanoid with click detector roblox 
Lua :: finding humanoid roblox. part 
Lua :: lua random numbers printing 
Lua :: roblox set color of text 
Lua :: lua to float 
Lua :: Lua how to comment 
Matlab :: matlab not less than 
Matlab :: alternative from two vectors matlab 
Basic :: excel vba chck that the range is empty 
Basic :: JsonFileWrapper 
Elixir :: elixir fibonacci 
Elixir :: elixir pipeline 
Scala :: scala jrtpath 
Actionscript :: Create menu group in Maximo 
Excel :: excel and formula 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =