How can I find a number of an item in a table?

How would I get the number of an item in a table, like:

                1   2   3
local Ltable = {"w","s","l"}

And then make it find like w, so like

local number = table.find(Ltable,"w")

But how can I get w number the place w is in the table

1 Like

doesnt this statement return what you are looking for?

2 Likes
local number
for i, ThinginTable in ipairs (Ltable) do
if ThinginTable == "w" then
number = i
end
end

print(number)
1 Like

table.find already does this for you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.