Hero192 Posted October 2, 2015 Share Posted October 2, 2015 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!! Link to comment
DNL291 Posted October 3, 2015 Share Posted October 3, 2015 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? Link to comment
TAPL Posted October 3, 2015 Share Posted October 3, 2015 You supposed to do it like that: if type(result) == "table" and #result > 0 then return true else return false end Link to comment
Hero192 Posted October 3, 2015 Author Share Posted October 3, 2015 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? Link to comment
TAPL Posted October 3, 2015 Share Posted October 3, 2015 Exactly, as we know if the query has succeeded it should return a table and the table should have at least one row. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now