“Roblox -Tabelle finden” Code-Antworten

Roblox -Tabelle finden

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
tomsterBG

Roblox -Tabelle finden

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
val

Ähnliche Antworten wie “Roblox -Tabelle finden”

Fragen ähnlich wie “Roblox -Tabelle finden”

Weitere verwandte Antworten zu “Roblox -Tabelle finden” auf Lua

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen