Feche1320 Posted October 13, 2014 Posted October 13, 2014 Hello, another of my questions local table = { [271] = 3000 } local table = { [0] = 3000 } Which one is better? I assume that [271] = 0 means that there are 270 empy tables using RAM for nothing, is this like this? The question is regarding a skin system were I am going to put the money on the variable and use the skinid as reference, thanks.
Anubhav Posted October 13, 2014 Posted October 13, 2014 The first one. ([271] = 3000 ) It's because [271] will be skin ID, and I guess 3000 will be the price. It won't create something empty, but if you use a loop remember to start from 1 or it can cause a nil This is only from my knowledge~!
eAi Posted October 13, 2014 Posted October 13, 2014 Tables aren't arrays, so they only allocate memory for the keys that contain values.
Feche1320 Posted October 14, 2014 Author Posted October 14, 2014 The first one.([271] = 3000 ) It's because [271] will be skin ID, and I guess 3000 will be the price. It won't create something empty, but if you use a loop remember to start from 1 or it can cause a nil This is only from my knowledge~! Tables aren't arrays, so they only allocate memory for the keys that contain values. Thanks guys!
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