lua-users home
lua-l archive

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


On Thursday 01 September 2005 20.28, Chris Marrin wrote:
[...]
> Lua behaves like most other scripting languages, like Javascript and 
> Python. Every data type is passed by value. But the value of an
> "object" (tables and userdata in Lua) is a reference to that object.

One way to think of it (and some languages actually take this the 
whole way, integer constants having methods and whatnot) is:
	1. Everything is an object.
	2. Variables and arguments are references to objects.

Then there are no exceptions. :-D

Well, except that some objects (like numbers and strings) are 
immutable - which has the side effect that it doesn't matter whether 
the underlying implementation copies the objects themselves, or 
references to them, when assigning to variables.


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---