DutchCaffeine Posted June 22, 2008 Posted June 22, 2008 Hello, I be busy with my class selection system. And i use tables/arrays for it, but it gives me every time an error: local classes = { 'police' = { There is everywhere i get the error of, it says that he misses a closing '}' char The script: http://paste.ubuntu.com/22093/ Alexander. Why looking here, while my post is up there /\
tma Posted June 22, 2008 Posted June 22, 2008 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
DutchCaffeine Posted June 22, 2008 Author Posted June 22, 2008 Thanks, i't is working now, and how! Why looking here, while my post is up there /\
robhol Posted June 22, 2008 Posted June 22, 2008 I'd like to advise you to use XML. It's not too hard, and it's a LOT easier to change and customize later on. Do NOT PM ME for help unless invited. - New MTA Script Editor Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.
Willy Posted June 23, 2008 Posted June 23, 2008 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.
eAi Posted June 24, 2008 Posted June 24, 2008 Use XML if you wish the data to be persistent or editable by administrators, otherwise use tables.
DutchCaffeine Posted June 24, 2008 Author Posted June 24, 2008 in my way i prefer tables, i had created first this system with xml but it wasn't working. And now, i've got the best system of the whole mta community Why looking here, while my post is up there /\
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now