lua-users home
lua-l archive

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


Lua doesn't support references to scalar values (numbers and strings). One way to emulate them is to wrap your values in tables, which are always of reference type. This topic has been discussed a few times before, see for example http://lua-users.org/lists/lua-l/2006-12/msg00370.html, References (as in Perl).

When searching for stuff like this, the mailinglist is also a valuable source. There's a search-form at http://lua-users.org/lists/lua-l/.

- Peter

Hello,

I am trying do something like this:

j = 'one'
k = j
j = 'one+'
k == 'one+'

but what I get is

k == 'one'

Is there any way for k to get j's value by reference j instead of getting its value copied?

If this is an FAQ my apologies. I tried to find info in the Manual and PIL2 but failed to find anything.