lua-users home
lua-l archive

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


Hi there,

I am trying to do something like "this" pointer in c++. now I make it
global variable, which works fine, but the problem is that when I
enclose a local function, the this pointer won't be deduced into
upvalues, because it is global variable. this can be fixed by adding a
declaration like

local this = this;

but it is sort of error-prone. it always causes troubles and hard to
detect. so I am looking for a more robust way where I can set "this"
as a local variable programmatically and it encloses itself.

Any idea is greatly appreciated!

Thanks,
Hao