Feche1320 Posted October 13, 2014 Share 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. Link to comment
Anubhav Posted October 13, 2014 Share 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~! Link to comment
eAi Posted October 13, 2014 Share Posted October 13, 2014 Tables aren't arrays, so they only allocate memory for the keys that contain values. Link to comment
Feche1320 Posted October 14, 2014 Author Share 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! Link to comment
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