Search
 
SCRIPT & CODE EXAMPLE
 

LUA

roblox how to find something in table

local t = {"a", "b", "c", "d", "e"}
print(table.find(t, "d")) -- 4
print(table.find(t, "z")) -- nil, because z is not in the table
print(table.find(t, "b", 3)) -- nil, because b appears before index 3
Comment

roblox table find

table.find(t, element) finds the index position of element. It returns nil if there is no element in the table.

  t = table
  element = thing you're trying to find
  
Its uses are

Quick verification that an element is in the table
Get the index of the element, probably so you can pop it from the list or any other index-based operations rather than element based
Comment

PREVIOUS NEXT
Code Example
Lua :: roblox random part color 
Lua :: roblox studio part color randomiser 
Lua :: roblox go thru all players 
Lua :: roblox buy gamepass script 
Lua :: lua find key in table 
Lua :: remove from table lua 
Lua :: make string all capital roblox 
Lua :: lua json 
Lua :: repeat until in lua 
Lua :: break in lua 
Lua :: lua for loops 
Lua :: hello world in lua 
Lua :: how to make everyone on team see name roblox 
Lua :: roblox get how many players in server 
Lua :: gun that shoot automaticly roblox 
Lua :: How to make a working gun in lua code 
Lua :: check if play is in group 
Lua :: Simple Roblox Lua Function 
Matlab :: matlab plot vertical line 
Matlab :: how to get the highest power of polynomial matlab 
Matlab :: geom_density_2d 
Basic :: how to round a number in visual basic 
Basic :: visual basic non modal message box 
Elixir :: elixir 
Elixir :: elixir with 
Scala :: reduce scala 
Actionscript :: octahedron 
Excel :: excel or 
Perl :: perl make a new directory and change permissions 
Pascal :: pascal online compiler 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =