'LinKin Posted November 15, 2013 Posted November 15, 2013 Hello, I'd like to know how does a table look like in LUA for MTA:SA When you define; local table = { } How does it look like? Like a vector? |_| |_| |_| |_| |_| |_| Or like a Matrice? |_||_||_||_| |_||_||_||_| |_||_||_||_| |_||_||_||_| |_||_||_||_| |_||_||_||_| The thing is, I want to have something like a matrice, where I can set a name(string) as one column and a number(int) as other column Need a clanwar script? Click here! Do you want some free scripts for your DD server? Visit my website.
tosfera Posted November 15, 2013 Posted November 15, 2013 if you create a empty table, it will look... empty. Just like the vector you showed us. Though, your first value decides what your table will look like. If you're adding a new table in it, it will be a matrice; local table = {} table.insert ( table, { "somename", 17 } ); If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
'LinKin Posted November 15, 2013 Author Posted November 15, 2013 if you create a empty table, it will look... empty. Just like the vector you showed us. Though, your first value decides what your table will look like. If you're adding a new table in it, it will be a matrice; local table = {} table.insert ( table, { "somename", 17 } ); Thanks mate, But now, how can I have access to the 2nd value of that table? Like; table[somename]=2. Would it work and change the 17 for the 2? Need a clanwar script? Click here! Do you want some free scripts for your DD server? Visit my website.
tosfera Posted November 15, 2013 Posted November 15, 2013 If you would be using a vector as a table it would be as simple as this; table[1] = "another name" Since you aint using that one, you've to say which row, which column. Just like a database; table[1][1] = "another name"; table[1][2] = 99; That would change the first row to 'another name' and 99. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
'LinKin Posted November 15, 2013 Author Posted November 15, 2013 Thanks a lot mate! This is what I was looking after. Need a clanwar script? Click here! Do you want some free scripts for your DD server? Visit my website.
tosfera Posted November 15, 2013 Posted November 15, 2013 Haha no problem, goodluck! If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
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