Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deal with Lua infinite loop? #96

Open
Charliechen1 opened this issue Jun 26, 2018 · 1 comment
Open

How to deal with Lua infinite loop? #96

Charliechen1 opened this issue Jun 26, 2018 · 1 comment

Comments

@Charliechen1
Copy link

What if the Lua script is something like
while true do end
Is there any method that could kill such running lua script?

@WillianBR
Copy link

@Charliechen1 ,

Please, check the comment I wrote into Issue #132.

I guess the debug package has the sethook() function.

But I didn't test it on go-lua. I'll test it later today!

Using the Lua "C" library, I was able to limite the instructions count (IC). But the dangerous function should bee called with pcall() inside the Lua script, to avoid errors. And hooking into IC event, we can stop the loop.

I also need such feature into my own project with go-lua.

WillianBR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants