Skip to content

How to deal with Lua infinite loop? #96

Description

@Charliechen1

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

Activity

  1. WillianBR commented on Aug 2, 2024

    @WillianBR

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions