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
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
doesnt this statement return what you are looking for?
local number
for i, ThinginTable in ipairs (Ltable) do
if ThinginTable == "w" then
number = i
end
end
print(number)
table.find already does this for you.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.