Cassandra Posted April 5, 2012 Posted April 5, 2012 Is it possible to create multi dimensional tables on LUA? If yes, can you provide me an example creation? Regards, Cassandra - V:MP
Castillo Posted April 5, 2012 Posted April 5, 2012 I'm not sure if this is what do you mean: items = { { [ "category" ] = "Weapons", [ "name" ] = "M4", [ "price" ] = 1000, [ "quantity" ] = 500 }, { [ "category" ] = "Skills", [ "name" ] = "M4 Skill", [ "price" ] = 2000, [ "quantity" ] = 1000 } } San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted April 5, 2012 Posted April 5, 2012 (edited) This? local cTable = { instance = { [1] = 'Crazy'; } } outputChatBox ( cTable.instance[1] ) Basically, is what Solidsnake said Edited April 5, 2012 by Guest EPT Team Server Development: 0% Learning C++ | C++ is amazing
Cassandra Posted April 5, 2012 Author Posted April 5, 2012 I'm not sure if this is what do you mean: items = { { [ "category" ] = "Weapons", [ "name" ] = "M4", [ "price" ] = 1000, [ "quantity" ] = 500 }, { [ "category" ] = "Skills", [ "name" ] = "M4 Skill", [ "price" ] = 2000, [ "quantity" ] = 1000 } } That's singular dimension. I want something like this. local items = { { name = "Something" weight = 20 height = 20 }, { playerid = 0 } } items[name][1] = "something" -- The first dimension is the info, the second dimension is the playerid Regards, Cassandra - V:MP
Kenix Posted April 5, 2012 Posted April 5, 2012 Both the codes wrong. local t = { tSecond = { nValue = 1; } } print( t.tSecond.nValue ) --1 ------- or ------------------------- print( t['tSecond']['nValue'] ) -- 1 -- ------- or ------------------------- print( t.tSecond['nValue'] ) -- 1 -- ------- or ------------------------- -- Some codes print( t['tSecond'].nValue ) -- 1 http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Cassandra Posted April 5, 2012 Author Posted April 5, 2012 Both the codes wrong. local t = { tSecond = { nValue = 1; } } print( t.tSecond.nValue ) --1 ------- or ------------------------- print( t['tSecond']['nValue'] ) -- 1 -- ------- or ------------------------- print( t.tSecond['nValue'] ) -- 1 -- ------- or ------------------------- -- Some codes print( t['tSecond'].nValue ) -- 1 Thanks but I have already found a way. Regards, Cassandra - V:MP
Kenix Posted April 5, 2012 Posted April 5, 2012 No problem. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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