lua-users home
lua-l archive

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


On Fri, Mar 09, 2012 at 03:44:38PM -0500, cynthia powers wrote:
> How does one achieve pass-by-value of lua functions arguments?

Numbers and bools and nil are essentially passed by value.  Strings,
because they are immutable, can be considered this too.  Tables,
userdata and such which are always passed as reference cannot be passed
by value.  You can emulate by-value passing of tables by doing a copy of
them.  Deep or shallow is up to you, depending on the data structure.

B.