Debian Codegraph @

lualib/lua_shape/plugin_schema.lua

raw
1 local Registry = require "lua_shape.registry"
2
3 local M = {}
4 local global_registry = Registry.global()
5
6 function M.register(id, schema)
7 if not id or not schema then
8 error("plugin_schema.register requires id and schema")
9 end
10
11 if not global_registry:get(id) then
12 global_registry:define(id, schema)
13 end
14
15 return global_registry:get(id)
16 end
17
18 return M