>>145
yeah me too. I'm sure developers using it in games would really appreciate it. It wouldn't require very much deviation from the language either, in fact, it might be implementable as is with some crazy hacks. Because nothing can actually be stored within a struct, just references to other values, a struct with n fields of arbitrary types can be implemented as a lua table using only the indecies, 1 .. n as keys. Doing this would ensure that it would look like a regular array under the hood. Then you could have table mapping field names to positions within the array:
apple_struct_field_locations = {num_seeds = 1,
color = 2,
age = 3}
and then,
somehow have lua locate every point in your code where an apple_struct is being indexed by one of the three constant keys above, and inline replace it:
apple_struct.num_seeds = 2
->
apple_struct[apple_struct_file_locations['num_seeds']] = 2
->
apple_struct[1] = 2
I can't think of a way to get this, other lisp style macros though.