Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eyal-wowhub/contracts

A library that provides Design by Contract like APIs to ensure functions adhere to specific preconditions and postconditions.
https://github.com/eyal-wowhub/contracts

lib library lua world-of-warcraft world-of-warcraft-addon wow wow-addon

Last synced: about 16 hours ago
JSON representation

A library that provides Design by Contract like APIs to ensure functions adhere to specific preconditions and postconditions.

Awesome Lists containing this project

README

        

# Contracts

A library that provides Design by Contract like APIs to ensure functions adhere to specific preconditions and postconditions.

#### Dependencies: [LibStub](https://www.curseforge.com/wow/addons/libstub)

### Example:

```lua
local C = LibStub("Contracts-1.0")

local function Divide(numerator, denominator)
C:IsNumber(numerator, 1)
C:IsNumber(denominator, 2)

C:Ensures(denominator ~= 0, "Divided by zero. The denominator cannot be zero.")

return numerator / denominator
end
```