Jump to content

repet


Monument

Recommended Posts

                    setTimer(function()
                    for i,v in ipairs(Table) do
                        if (T1== v[1] and T2 == v[2] and T3 == v[3]) then
                        outputChatBox('true')
                        else 
                        outputChatBox('false')
                        end
                    end
                    end,1000,1)

this is my code when first the condition will output 'true'

but when output 'true' be repetitive

any help to be 1 time only with out repet

Link to comment

If I'm not mistaken, you want to exit the loop when the condition is met, if so, you can exit the loop with the return command.

if you want to continue the code from the bottom line you can also use break command

setTimer(function()
                    for i,v in ipairs(Table) do
                        if (T1== v[1] and T2 == v[2] and T3 == v[3]) then
                        outputChatBox('true')
                        return
                        else 
                        outputChatBox('false')
                        end
                    end
                    end,1000,1)

 

Edited by Burak5312
Link to comment
42 minutes ago, Burak5312 said:

If I'm not mistaken, you want to exit the loop when the condition is met, if so, you can exit the loop with the return command.

if you want to continue the code from the bottom line you can also use break command


setTimer(function()
                    for i,v in ipairs(Table) do
                        if (T1== v[1] and T2 == v[2] and T3 == v[3]) then
                        outputChatBox('true')
                        return
                        else 
                        outputChatBox('false')
                        end
                    end
                    end,1000,1)

 

done but same thing

i want when output be without spam

only 1 output

now its with more 10 output

Link to comment
8 minutes ago, Burak5312 said:

can you show the full code?

it's in 1 function

timer with table Table = {

{"1","2","3"}

}

setTimer(function()
                    for i,v in ipairs(Table) do
                        if (T1== v[1] and T2 == v[2] and T3 == v[3]) then
                        outputChatBox('true')
                        return
                        else 
                        outputChatBox('false')
                        end
                    end
                    end,1000,1)
1 minute ago, Monument said:

it's in 1 function

timer with table Table = {

{"1","2","3"}

}


setTimer(function()
                    for i,v in ipairs(Table) do
                        if (T1== v[1] and T2 == v[2] and T3 == v[3]) then
                        outputChatBox('true')
                        return
                        else 
                        outputChatBox('false')
                        end
                    end
                    end,1000,1)

 

10 minutes ago, Burak5312 said:

can you show the full code?

reason is the ipairs but how fix it i don't know

Link to comment
12 hours ago, Burak5312 said:

 

are you sure no other resource is causing this because only this code is not causing something like this I don't know what you are trying to do but you can do this code without a for loop 

i try to do it as
 

if T1 == "1" and T2 =="2" and T3 =="3" then

the output only 1 message

but i have alot of data in table i can't do all as if

Link to comment

Hey,

This is a way to prevent the spam:

setTimer(function()
	local found = false

	for i,v in ipairs(Table) do
	    if (T1 == v[1] and T2 == v[2] and T3 == v[3]) then
	    	found = true
	    	break
	    end
	end

	if found then
		outputChatBox('true')
	else
		outputChatBox('false')
	end
end,1000,1)

 

Link to comment
2 hours ago, SpecT said:

Hey,

This is a way to prevent the spam:


setTimer(function()
	local found = false

	for i,v in ipairs(Table) do
	    if (T1 == v[1] and T2 == v[2] and T3 == v[3]) then
	    	found = true
	    	break
	    end
	end

	if found then
		outputChatBox('true')
	else
		outputChatBox('false')
	end
end,1000,1)

 

thx its work good

thx for all

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...