> But as you said, this "long running C function" could be a third-party one, thus there is no guarantee the flag will be checked, isn't it?
There is no guarantee, but when there is common "abort" API that third-party libraries can use, some of them will use it. Then anyone needing a sandboxed Lua environment can take those libraries that support it, patch those that do not, or develop something from scratch. With common API, all of that will inter-operate nicely.