[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] APow 1.0
- From: "Soni L." <fakedme@...>
- Date: Sat, 18 Feb 2017 19:20:19 -0200
Hello! I needed an annotation library, for annotations. So I made an
annotation library. It's called Annotation^, or APow.
Repo: https://bitbucket.org/TeamSoni/apow
Features:
- Uses itself to define the annotation annotation (kinda).
- Simple API.
- Adds annotations.
- All rights reserved.
- Tiny. Less than 512 bytes.
To use it, just require "apow".annotation ^ function(self, target) [your
annotation handler here] end.
For example, here's a simple module that defines a notnil annotation:
- - -
local apow = require "apow"
local notnil = apow.annotation ^ function(self, target)
if target == nil then
error("value must not be nil")
end
return target
end
return {notnil = notnil}
- - -
Which can then be used as follows:
- - -
local notnil = require "notnil".notnil
local function f(x)
x = notnil ^ x
end
assert(pcall(f, 1))
assert(not pcall(f, nil))
- - -
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.