Making Tables

I am attempting to create a table that will output something of the following:



"superadmin"
     "prop_physics" = 500
     "ragdolls" = 10
"admin"
     "prop_physics" = 300
     "ragdolls" = 5
"user"
     "prop_physics" = 50
     "ragdolls" = 0


This would obviously be a table consisting of keys corresponding to group names and values which are equivelent to an assosciative arrays of class names and values.

This is my attempt at this:



Limits = {
	"superadmin" = {
		"prop_physics" = 1000,
		"ragdolls" = 10
	},
	"admin" = {
		"prop_physics" = 500,
		"ragdolls" = 10
	}
	"user" = {
		"prop_physics" = 50,
		"ragdolls" = 0
	}
}


Unfortunately, it does not work. Any guidance on how I would do this is most appreciated.

You posted this AFTER i helped you over steam? :Dawkins102:

That would be a dumb thing to do. L2Compare times. ;3

But there are different ways of doing this, and I’d like to learn them.

[lua]
Limits = {
“SuperAdmin” = {
“prop_physics” = 1000;
“ragdolls” = 10;
}
“Admin” = {
“prop_physics” = 500;
"ragdolls = 10;
}
“User” = {
“prop_physics” = 50; – 50 props? What the fuck, can’t build anything with that.
“ragdolls” = 0;
}
}

function PlayerWhat§

 for k,v in pairs(Limits) do
      if( tostring(v) == "SuperAdmin" ) then
            if( p:IsSuperAdmin() ) then
                    p.MaxProps = v.prop_physics or 9001;
            end
      end
  end

end
[/lua]

Read this.

Thanks, this was actually rather useful. Silly I didn’t go there myself.

You need a comma to separate the inside tables (semicolon also works).
“string” = value doesn’t parse. It’s either [“string”] = value or string = value.
[lua]Limits = {
SuperAdmin = {
prop_physics = 1000,
ragdolls = 10
},
Admin = {
prop_physics = 500,
ragdolls = 10
},
User = {
prop_physics = 50,
ragdolls = 0
}
}[/lua]

Yeah, I gathered that from that lua article, thanks anyway.