Jump to content

Simple question


Hero192

Recommended Posts

Posted

Hey again,

i want to be sure about the meaning of this checking, as you know we got result from dbPoll

so result must be not a table and it must equal 0?

can anyone correct me if im wrong

if not ( type( result ) == "table" and #result == 0 ) or result then 
        return true 
    else 
        return false 
   end 

~Thanks in advance!!

Posted

That if statement is checking if 'result' isn't a table and its length is equal to 0. If it's not true, it will check if 'result' is not nil or false and will return true.

What do you want to do exactly? What kind of checking you want to do?

Posted

You supposed to do it like that:

if type(result) == "table" and #result > 0 then 
    return true 
else 
    return false 
end 

Posted
if type(result) == "table" and #result > 0 then 
    return true 
else 
    return false 
end 

So, as i understand the result of poll is a table and it must be higher than number zero '0' to return true if not it will return false?

Posted

Exactly, as we know if the query has succeeded it should return a table and the table should have at least one row.

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