lua-users home
lua-l archive

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


I am looking for a way to call my own C++ function automatically at the end of each line in a Lua script.  The Lua SetHook function seems to do this:
http://pgl.yoyo.org/luai/i/lua_sethook

However, the HOOK_MASKLINE function description has one giant caveat in its description:
(This event only happens while Lua is executing a Lua function.)

I am not sure what this means, but the hook doesn't seem to get called in the manner I expect.  If I had a script like below, I would expect the hook to be called after executing each line:
local a = 1 --hook executed!
local b = a + 1 --hook executed!
b = b + 2 --hook executed!

Is the functionality I want supported in Lua?  Thanks.


Best Regards,

Josh Klint
CEO
Leadwerks Software