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 exit doFile #132

Open
HarryChen001 opened this issue Jan 19, 2024 · 1 comment
Open

how to exit doFile #132

HarryChen001 opened this issue Jan 19, 2024 · 1 comment

Comments

@HarryChen001
Copy link

there is a loop in lua file, and i call lua.DoFile() run it with block,how can i stop or restart lua vm but keep my main program process

@WillianBR
Copy link

Hello @HarryChen001,

The original "C" Lua engine has a debug feature to limit the CPU time. But I'm not sure if the GO version has such feature!

The Lua manual https://www.lua.org/manual/5.2/manual.html#lua_sethook has a function description to hook the Lua VM and limit the CPU usage.

int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);

It's something like this:

lua_sethook(L, hook_func, LUA_MASKCOUNT, num_instructions_per_hook);

I guess, we should read the documentation or source code to findout!

@fbogsany,

Do we have anythink like that in go-lua?

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