Jump to content

problem with array


Recommended Posts

Hi, i have 1 problem with one array, i'm creating one system but i need make a number in the array.

 

Example:

		itemsalchemie = {
			--- round 1
			[0] = { -- number of round
				[0] = {1130, 1}, -- [0] = number of item, vnum and ammount
				[1] = {1131, 1},
				[2] = {1132, 1},
				[3] = {1133, 1},
				[4] = {1134, 1},
				[5] = {1135, 1},
				[6] = {1136, 1},
				[7] = {1137, 1}
			},
			--- round 2
			[1] = {
				[0] = {1130, 1},
				[1] = {1131, 1},
				[2] = {1132, 1},
				[3] = {1133, 1},
				[4] = {1134, 1},
				[5] = {1135, 1},
				[6] = {1136, 1},
				[7] = {1137, 1}
			}
		}
		
		local ran = number(1, table.getn(itemsalchemie[0])) --- this use a number in the round 1?
		
		local ran = number(1, table.getn(itemsalchemie[1])) --- this use a number in the round 2?
				
		

I need put a number or math.ramdom in the locan ran but, in the round selected

 

Thanks.

Link to comment
Share on other sites

  • Former Staff

And if i need put a syschat to show the dates?

 

 

sychat("itemsalchemie[0][ran][1].." "..itemsalchemie[0][ran][2].." "..itemsalchemie[0][ran][3].." "..itemsalcheme[0][ran][4]) <--- this is ok?

 

 

sorry my bad english.

itemsalchemie[0][ran][1]

will return the amount you specified at the top of a random item from table one.. the other give empty table error. if you want to return the whole table:

 

local output = ""
for i = 0, table.getn(itemsalchemie[0]), 1 do
output = output..itemsalchemie[0][i].." "
end

syschat(output)
  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.