storing information in lua
(new to using lua 5.0)
In a lot of my designs, I''m using a master table to keep track of every entity of a specific type, so in your experience what are the pros and cons and which do you think is a better way to handle this situation:
--like so
MasterTableOfAllFoos[Bar] = ...;
-- or thus
MasterTableOfAllFoos[1].name = Bar;
If I use an ordered array and need to access a member by name I''ll have to search the whole table every time.
If I use an associative array how do I access the key? For instance I need to ouput a text file or in general need to serialize this member. Even if I have a member called .key and make it equal to Bar, how do I access Bar in the first place?
I''ve been programming in C so long this whole having one data structure for everything is spinning my head around.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement