lua-users home
lua-l archive

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


> I want to add a flag (lets name it 'keepAlive') to gc-managed Lua values
> (tables, closures, strings) that will prevent garbage collection of this
> values even if there are no strong references to them

Just turn on the FIXEDBIT in the marked field.

For strings there is a macro:

lstring.h:#define luaS_fix(s)	l_setbit((s)->tsv.marked, FIXEDBIT)