MisterQuestions Posted January 27, 2015 Posted January 27, 2015 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?
GatoGrande Posted January 28, 2015 Posted January 28, 2015 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"
MisterQuestions Posted January 28, 2015 Author Posted January 28, 2015 but i want to get index, searching from a value
Castillo Posted January 28, 2015 Posted January 28, 2015 for index, data in ipairs ( mytable ) do if ( data [ 1 ] == "myAccount" ) then outputChatBox ( index ) end end
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now