Jump to content

Problem with tables


Recommended Posts

Posted

I think it's the way you're declaring the array indicies. Try it like this instead:

  
local classes = { 
    civilians       = { 
        title       = 'Street people', 
        team        = 'civilian', 
        message = 'Living people on the streets,\nThey do just normal!' 
    }, 
    ... 
  

You can then access like:

  
local p = classes["civilians"] 
  

OR

  
local p = classes.civilians 
  

Posted

I'm going to have to disagree, i've recently written a script and it was a toss up between xml or lua tables, and it turns out that tables were by far the best to use. Once you realise the power of tables XML becomes as insignificant as Brophy's sexual advances.

Posted

Use XML if you wish the data to be persistent or editable by administrators, otherwise use tables.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...