lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 08/04/2011 23:19, Rob Hoelz whispered from the shadows...:
> They don't really conflict at all.  You're storing a reference to a
> table; i.e. a memory address.  If you share that address between two
> closures, they can both change the contents stored at that address.
> If you store a number in that upvalue instead, altering it in one
> closure wouldn't affect the upvalue of the other.  It's kind of like
> the difference between passing an int to a C function versus passing
> a pointer to a struct to a C function.

Ah. Ok. That's clears things up. Upvalues are pass by value vs pass by
reference.

Cheers.

-- 
Anthony C Howe            Skype: SirWumpus                  SnertSoft
                        Twitter: SirWumpus      BarricadeMX & Milters
http://snert.com/      http://nanozen.info/     http://snertsoft.com/