lua-users home
lua-l archive

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


On Thu, Jun 17, 2021 at 11:57 PM Soni "They/Them" L. <> wrote:
> We guess there's no way to make safe self-referential functions in Lua?
> local function x <const>() end -- doesn't work

Only const self-referencial, but you are right. Const glitch apart,
3.4.11 does not list these syntax as valid.

I assume if The Team gets to it via some magic it can be made to work,
and documented in a couple lines. Meanwhile I think the same effect
can be achieved using a tmp ( local _f=function()..end; local f
<const> = _f ) which should only imply a little namespace pollution.

Francisco Olarte.