Hello everyone.
Long story short I am working on this project and I am having some issue with tables...
print( ply.testtable[1] )
print( ply.testtable["tablestring"] )
PrintTable( ply.testtable )
if( ply.testtable[doesitexist] ~= nil ) then
print("it exists in the table")
end
My issue is that "print( ply.testtable[1] )" prints "tablestring" as it should do. But "print( ply.testtable["tablestring"] )" prints nil. Why is it doing that?
The prints returns this:
tablestring
nil
PrintTable returns this:
1 = tablestring
do not that the code above is just an example
Because you're not setting t["key"] to anything. Keys and values are completely different.
Fixed it using this method instead:
if( table.HasValue( ply.testtable, "tablestring" ) ) then print("it exists") end
Ty for quick reply!
Sorry, you need to Log In to post a reply to this thread.