Sign in to follow this  
ThePCGuy

index

Recommended Posts

Hi,

Is there a tutorial for:

example:

for index, players in ipairs( something ) do

I dont know how to use it and what to fill in.

Share this post


Link to post

Ok. But,

for index, players <----  (is there a list of what i can fill in here?)  in ipairs( something ) do 

Thanks.

Share this post


Link to post
for index, player in ipairs ( getElementsByType ( "player" ) ) do 
    -- Do something 
end 

That's what you meant?

Share this post


Link to post

I meant, is there a list of where can i get the index of, now you will get all the players.

Share this post


Link to post

Depends on the table, 'for' is used for loops in general, not just for tables with player elements.

Share this post


Link to post

If you mean that is it necessary to be "index, player" then No, You can but whatever you want .

for k,v ... 
for index,player ... 
for i, anything ... 

Share this post


Link to post

thanks, that helped me alot too

LoL, Loops and tables are probably hardest things in Lua :)

Share this post


Link to post
thanks, that helped me alot too

LoL, Loops and tables are probably hardest things in Lua :)

No it's the easier thing!

Share this post


Link to post
thanks, that helped me alot too

LoL, Loops and tables are probably hardest things in Lua :)

No it's the easier thing!

If its easy for you, could you make a tutorial where you create any kind of system with tables and loops and lots of detailed explanations, that would be great! :)

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.