aarzilli / golua

Go bindings for Lua C API - in progress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Possibility to use Go Function as Callback in lua debug hook

Simerax opened this issue · comments

I have seen that the Wrapper offers a 'SetExecutionLimit' Function to limit the number of instructions that a lua vm can execute before being terminated.
I would like to be able to have a little more control over this debug hook. Would it be possible to add a Golang Callback which gets called as soon as the hook gets triggered?

The rationale for this is that I would like to be able to terminate the VM based on timeouts and not on the number of instructions it ran. I know that it's not really possible to have precise timeouts since the hook only gets called when code is actually executed but it would already be more then enough for me to have rough timeouts.

Well, maybe im looking at this from the wrong angle and there is a better way to achieve timeouts - if that's the case please let me know!