[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: about tables, Table and metatables :o)
- From: Coda Highland <chighland@...>
- Date: Fri, 17 Jul 2015 23:46:58 -0700
On Fri, Jul 17, 2015 at 10:35 PM, voidptr <firstname.lastname@example.org> wrote:
> ok this is maybe why it will be messy (my guest) , there is no distinction
> between user/script table and lua internal table...
> so in fact if you dont want to have metatable associate with _G or any other
> system tables, you just dont give it by default ...
> I thought it could have been 2 ways to create table, clean system one, or
> with metatable for user ..
> ... so one size fit all, will not be the right size for all ... lol
> too bad :o)
The problem is that there may be more than one user.
If I import a library, and that library customizes "user" tables for
its own internal use, then your code's behavior could change.
If you import TWO libraries, and EACH one does that, then you're
totally screwed, because they'll step on each other's toes.
The same is true of messing with the string metatable or the nil
metatable, but those have less far-reaching implications, and for the
most part people tend to want to do the same things with them. Tables
are more generic.