• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[HELP]Getting array information out of another array

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,136
Solutions
12
Reaction score
1,115
Location
Germany :O
Hello
I have a question about getting an information from an array which is in another array.

Example:
Code:
array = {
[1] = {id = 1367, count = {12,16}},
[2] = {id = 1569, count = {92,55}}
}

How I get the count out of that?
Maybe like this:

array[1].count[1] and array[1].count[2] for first one??

or how I have to do that?
 
array[1].count --count of array number 1
array[2].count --count of array number 2

Example
LUA:
local array =
{
	[1] = {id = 2195, count = 10},
	[2] ) {id = 2196, count = 20
}

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "" .. getItemNameById(array[1].id) .. " count: " .. array[1].count .. ".")

Message: Boots of haste count: 10.
 
Yes, that will work.

LUA:
function onSay(cid, words, param, channel)


array = {
[1] = {id = 1367, count = {12,16}},
[2] = {id = 1569, count = {92,55}}
}

doPlayerSendTextMessage(cid, 22, array[1].count[1])
end
 
Last edited:
but darkhaos just told it as count wasn't an array, just a normal variable..
 
Back
Top