[LUA] Array in array

Hy all,

I’ve been working with lua for a little while know and i can’t get past a certain point, I have this array in an array, i took it from the ULIb data files (which are different, i know), and tried to make an array in array array (lol!?).

Here’s what I got: (the inital line number is 3)


local differentWeapons = {
	"vip" => {
		"weapon_crowbar",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_smg1",
		"item_ar2_grenade",
		"item_ar2_grenade"
	}
	"members" => {
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"item_ar2_grenade",
		"item_ar2_grenade",
		"item_healthkit"
	}
	"anyone" => {
		"weapon_physgun",
		"gmod_camera"
	}
}

This gives me an error


autorun/server/weaponCheck.lua:4: '}' expected (to close '{' at line 3) near '='

I tried using (the inital line number is 3 again)


local differentWeapons = {
	"vip"
	{
		"weapon_crowbar",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_frag",
		"weapon_smg1",
		"item_ar2_grenade",
		"item_ar2_grenade"
	}
}

but that gives an error too.

Does anyone know the correct code for this?

Thanks in advance,
Roelof

PS: Why is the post icon LUA Scripting not in my list?

[lua]
local array =
{

array2 =
{

},

array3 =
{

}

};
[/lua]

You can also do:

[lua]
local array =
{

[ "array2" ] =
{

}

};
[/lua]

If you want the key to be a non-identifier or you want to set the key from a variable.

Thanks Nevec