@@ -5,10 +5,13 @@ atomic.class = atomic.class or {
55 [atomic .meta .version ] = {}
66 }
77 },
8-
9- --- @type Atomic.Package
10- --- @diagnostic disable-next-line
11- pseudo = { id = " atomic" , version = atomic .meta .version };
8+ pseudo = {
9+ _metadata = {
10+ id = " atomic" ,
11+ version = atomic .meta .version ,
12+ documentation = " https://github.com/TeamMeadows/atomic-framework/wiki" ,
13+ }
14+ }
1215}
1316
1417--- @class Atomic.Class
@@ -30,7 +33,6 @@ function atomic.class.create(name, parent)
3033 local class = setmetatable ({ _name = name }, { __index = parent or classMt })
3134 class .__index = class
3235 class .__tostring = function (self )
33- --- @diagnostic disable-next-line
3436 return " instance of " .. tostring (self ._name )
3537 end
3638
5860--- @generic T
5961--- @return T : Atomic.Class ?
6062function atomic .class .get (name , packageOrId , packageVersion )
61- local pkgName = type (packageOrId ) == " table" and packageOrId .id
63+ local pkgName = type (packageOrId ) == " table" and packageOrId ._metadata . id
6264 or type (packageOrId ) == " string" and packageOrId
6365 or not packageOrId and " atomic"
6466
65- local pkgVersion = type (packageOrId ) == " table" and packageOrId .version
67+ local pkgVersion = type (packageOrId ) == " table" and packageOrId ._metadata . version
6668 or type (packageVersion ) == " string" and packageVersion
6769 or pkgName == " atomic" and atomic .meta .version
6870
7678--- ```
7779---
7880--- @generic T
79- --- @param class Atomic.Class
80- --- @param tab T ? Content of the instance
81- --- @vararg any
81+ --- @param class T : Atomic.Class
82+ --- @vararg any Arguments to be passed to the class constructor
8283--- @return T : Atomic.Class
83- function atomic .class .new (class , tab , ...)
84- local instance = setmetatable (tab or {}, class )
84+ function atomic .class .new (class , ...)
85+ local instance = setmetatable ({}, class )
8586
8687 if (type (instance .init ) == " function" ) then
8788 instance :init (... )
125126--- @param package Atomic.Package
126127function atomic .class .register (class , package )
127128 local storage = atomic .class ._storage
128- local id , version = package .id , package .version
129+ local id , version = package ._metadata . id , package . _metadata .version
129130
130131 if (type (storage [id ]) ~= " table" ) then
131132 storage [id ] = {}
@@ -135,7 +136,6 @@ function atomic.class.register(class, package)
135136 storage [id ][version ] = {}
136137 end
137138
138- --- @diagnostic disable-next-line
139139 storage [id ][version ][class ._name ] = class
140140
141141 atomic .class ._storage = storage
@@ -145,7 +145,6 @@ function atomic.class.unregister(class, package)
145145 local storage = atomic .class ._storage
146146 local id , version = package .id , package .version
147147
148- --- @diagnostic disable-next-line
149148 storage [id ][version ][class ._name ] = nil
150149
151150 atomic .class ._storage = storage
0 commit comments