Skip to content

v3.0.0

Choose a tag to compare

@maurits150 maurits150 released this 17 Jan 15:29
· 17 commits to 3.x since this release

Changelog

This is a full rewrite of simploo. The list below covers major changes but is not exhaustive.

Documentation

Full documentation available at https://maurits150.github.io/simploo/

Interfaces

Define contracts with the interface keyword and implement them with implements. Interfaces can extend other interfaces and provide default method implementations. Enable strictInterfaces config for argument validation (Lua 5.2+).

Serialization

Instances can be serialized with instance:serialize() and reconstructed with Class:deserialize(data). Use the transient modifier to exclude members. Convenience wrappers simploo.serialize() and simploo.deserialize() are also available.

New Modifiers

  • default - for interface default method implementations
  • transient - exclude members from serialization

Other

  • instance:get_member(name) and instance:get_members() for introspection
  • hook:remove(hookName [, callbackFn]) to unregister hooks
  • baseInstanceTable, baseSyntaxTable, customModifiers config options
  • Classes in the same namespace can reference each other without using
  • protected access control now enforced (v2 had the modifier but ignored it)
  • Custom __index/__newindex metamethods via meta modifier
  • instance_of() works with interfaces: player:instance_of(ISerializable)

Performance

  • Faster instantiation (only instance variables are copied, functions/statics are shared)
  • Faster member access (optimized __index/__newindex)
  • Faster instance_of() checks (O(1) ancestor lookup)

Breaking Changes

  • __declare renamed to __register
  • __tostring requires meta modifier
  • __construct cleared after call (prevents double-calling)
  • Assignment to undefined members now errors
  • abstract modifier removed (use interfaces)
  • Hooks renamed:
    • onSyntaxNamespace → onNamespace
    • onSyntaxUsing → onUsing
    • beforeInstancerInitClass → beforeRegister
    • afterInstancerInitClass → afterRegister
    • afterInstancerInstanceNew → afterNew