Jump to content

Search a table position with a string or something?


Recommended Posts

Posted

Hey, it is possible to search an item position on a table, by a string?

mytable = {

[1] = {account1,name1}

[2] = {account2,name2}

}

example i want to get a position on the table for example i want to get [1] searching by it name or account

How can i make it?

Posted

Not sure what you mean. You could do what Solidsnake14 said if that's what you mean, or from my understanding use a string as the key.

Example:

my_table = { 
    ['index 1'] = "Value", 
    ['Another Index'] = "Value 2" 
} 
-- You could use my_table["index 1"] to get "Value" 

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