mrdocs::lua::makeCallable

Wrap a registry‐anchored Lua function as a dom::Function.

Synopsis

[[nodiscard]]
dom::Function
makeCallable(
    Context ctx,
    int ref);

Description

The returned function invokes the referenced Lua function, marshalling arguments and result as DOM values, and owns the reference (released when the last copy is destroyed). Used by the extension API's mrdocs.register_transform / register_generator.

Return Value

A dom::Function that calls the anchored Lua function.

The return value should not be discarded.

Parameters

Name

Description

ctx

The Lua context whose registry holds the function and that the returned callable keeps alive.

ref

A luaL_ref(L, LUA_REGISTRYINDEX) reference to a function value in ctx's state.

Created with MrDocs