lua-users home
lua-l archive

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


Wow! Now this is bewildering:

------------------
They might look like they're being passed by reference, but they're
not. All arguments in Lua are passed by value. They are not passed by
copy, so when you pass a table (by value) you are passed the same
table,
------------------

Not passed by reference? And not passed by copy either?  I don't get it.
Those are the only two options.  If its not a reference/pointer, and its not
a copy of the value...then...what?

Perhaps this is just a semantics issue.  Perhaps a variable "containing" a
table, internally is implemented somewhat like a pointer, but is exposed to
lua as a regular variable.  If that is the case (and I suppose that is
correct), then you could say tables are passed by value, yet modifying the
content of the passed table will indeed affect the original (as if it were a
pass by reference).

Is this correct?

-Brent