[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: [ANN] APow 1.0
From: "Soni L." <fakedme () gmail ! com>
Date: 2017-02-18 21:20:19
Message-ID: 4ab6b78e-b4d7-4e86-c8ee-d8db277ba553 () gmail ! com
[Download RAW message or body]
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic