Jump to content

Count Table


undefined

Recommended Posts

Posted

Hi guys. Im work on the party system.

local test = { 
    test2 = { 
        ["userdata: 46f6s68"] = { 
            leader = "ZoRRoM^", 
            member = {} 
        }, 
        ["userdata: 54fghd9"] = { 
            leader = "Narkoz", 
            member = {} 
        } 
    } 
} 
outputChatBox(#test.test2)   

Im try it for the get count table. But it's not work.

It's have 2 count. But #test.test2 say's 0.

How to fix it?

  • Moderators
Posted
local tableRange = 0 
for key,data in pairs(test.test2) do 
    tableRange =    tableRange+1 
end 
outputChatBox(tableRange) 

Tables without using the array can't use #.

If this table had an array it would only have numbers as index.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted
Welcome from IIYAMA's Side....i'm his brother :D

xD

huh????

:shock:

@AbaZaSiRiN00

np.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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