[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Arguments by reference?
- From: David Olofson <david@...>
- Date: Thu, 1 Sep 2005 20:49:11 +0200
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 ---