-- Anomaly Packer - xray class builder runtime. -- Copied into the build automatically when a script imports 'anomaly-packer/class', -- under the per-addon name __ap_class.script. Anomaly Packer rewrites that -- import to reach this function as __ap_class.defclass(...). -- Wraps the engine's global `class` DSL: creates the class (with optional base) and -- copies the single body table (fields and methods, including __init) onto it, then -- returns it so the transpiled `local Foo = defclass(...)` keeps a constructable reference. function defclass(name, body, base) local cls = base and class(name)(base) or class(name) for k, v in pairs(body) do cls[k] = v end return cls end