49
edits
m (Move page script moved page API tContains to WoW:API tContains without leaving a redirect) |
No edit summary |
||
| Line 6: | Line 6: | ||
; Implementation | |||
<lua> | |||
function tContains(table, item) | |||
local index = 1 | |||
while table[index] do | while table[index] do | ||
if item == table[index] then | |||
return 1 | |||
end | |||
index = index + 1 | |||
end | end | ||
return nil | |||
end | |||
</lua> | |||
== Examples == | |||
== | |||
banana = { "yellow", "curved", "yummy" }; | banana = { "yellow", "curved", "yummy" }; | ||
| Line 26: | Line 27: | ||
eatme = tContains( lotus, "yummy" ); | eatme = tContains( lotus, "yummy" ); | ||
;Result | |||
eatme = false | eatme = false | ||