Skip to content

Feature Request #2: Support explicitly closing Lua VMs from Lua instance directly and/or add a Lua::strong_count API #571

Open
@cheesycod

Description

@cheesycod

E.g. using lua_close. Following a close operation, safety could (probably) be ensured by disallowing any Lua VM operations whatsoever.

Right now you need to drop all references to Lua VM to do so.

Even if a explicit close method is not possible, it would be nice for mlua to at least expose a strong count api for debugging (I actually had to fork mlua and add Lua::strong_count() to track down where I'm leaking RawLua handles). It’d also be nice if mlua had a feature flag to block cloning of Lua at compile time

Lastly, would it be possible to make things like WeakLua::state etc not panic if the Lua VM is destroyed somehow and instead return an error (and would doing so be beneficial?)

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