diff --git a/USAGE.md b/USAGE.md index f7be3cc..2819c02 100644 --- a/USAGE.md +++ b/USAGE.md @@ -155,7 +155,7 @@ resource = bitser.register(name, resource) ``` Registers the value `resource` with the name `name`, which has to be a unique string. Registering static resources like images, -functions, classes and huge strings, makes sure bitser doesn't attempt to serialize them, but only stores a named +functions, classes, huge strings and LuaJIT ctypes, makes sure bitser doesn't attempt to serialize them, but only stores a named reference to them. Returns the registered resource as a convenience. @@ -189,7 +189,7 @@ If not nil, the argument `classkey` should be a string such that If not nil, the argument `deserializer` should be a function such that `deserializer(obj, class)` returns a valid instance of `class` with the properties of `obj`. `deserializer` is allowed to mutate `obj`. -Returns the registered resource as a convenience. +Returns the registered class as a convenience. See also: [`bitser.unregisterClass`](#unregisterclass). diff --git a/bitser.lua b/bitser.lua index e04c17e..dbbaf8c 100644 --- a/bitser.lua +++ b/bitser.lua @@ -14,6 +14,8 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ]] +local VERSION = '1.1' + local floor = math.floor local pairs = pairs local type = type @@ -469,4 +471,4 @@ end, unregisterClass = function(name) classkey_registry[name] = nil class_deserialize_registry[name] = nil class_registry[name] = nil -end, reserveBuffer = Buffer_prereserve, clearBuffer = Buffer_clear} +end, reserveBuffer = Buffer_prereserve, clearBuffer = Buffer_clear, version = VERSION}