|
| 26 May 2012 09:09 PM |
Is there a way to check if a specific table has any elements?
† KMXD † |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 26 May 2012 09:56 PM |
t = {1,3,4,6,7} specificElement = 5 function SearchForElement(Table,Element) for i,v in pairs(Table) do if v == Element then return true end end return false end
print(SearchForElement(t, 5))
-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]- |
|
|
| Report Abuse |
|
|
|
| 26 May 2012 10:04 PM |
@Swim
I meant could I could simply use an if statement to check if there are no elements in a table?
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 26 May 2012 10:16 PM |
t = {} print(#t) >0
-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]- |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 May 2012 10:07 AM |
| That is what I was intending to say, But I wasn't sure what exactly you were trying to do, If you provided an example, perhap I could have found out :) |
|
|
| Report Abuse |
|
|