lua-users home
lua-l archive

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


>>>>> "孙世龙" == 孙世龙 sunshilong <sunshilong369@gmail.com> writes:

 孙世龙> It seems impossible to get the filename in the self-defined
 孙世龙> hook function (lua-5.3.5).

You would get it by calling lua_getinfo in the usual way, as is
EXPLICITLY documented for lua_Hook:

  "To get the value of any other field in ar, the hook must call
   lua_getinfo."

Having luaD_hook fill it in is a bad idea since you'd be adding overhead
to every hook call whether the value is needed or not.

-- 
Andrew.