Jump to content

[HELP] How to use table.find function?


Turbesz

Recommended Posts

I tried this method, but does not work:

local tabla = {"Valami", "ASdasd", "Teszt", "Proba"}

function teszt()
local talalat = table.find(tabla,"Va")
outputChatBox(talalat)
end

addCommandHandler("test",teszt)

function table.find(tabl,word) 
	if type(tabl) ~= "table" or word == nil then 
	return false 
	else 
	local ret = false 
	for k,v in pairs(tabl) do 
		if v == word then 
		return k 
		end 
	end 
	end 
	end 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...