pub fn register_protected(
lua: &Lua,
name: &str,
build: impl FnOnce(&LuaTable<'_>) -> Result<(), LuaError>,
) -> Result<(), LuaError>Expand description
Publish name as a read-only API table.
build fills the real table — Rust fields and, via lua.load, any Lua helper functions, which
is why it runs while name is still bound to the real table. The proxy replaces it afterwards;
from then on the helpers resolve name to the proxy and read through it, which is exactly what
a script does.