Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lib = require ( ’ angine / lib / alfa ’)
- local __test = lib . test
- local __subseteq = lib . subseteq
- local __issubseteq = lib . issubseteq
- local __iselement = lib . iselement
- local example = {}
- local __example = function ( example )
- function example . Main ( ctx , actions , handlers )
- if not ctx . action then
- return actions . indeterminate
- end
- if not ( ctx . action == " select " ) then
- return actions . notapplicable
- end
- local function r1 ( ctx , actions , handlers )
- if not ctx . entity . level or not ctx . subject . level then
- return actions . indeterminate
- end
- if ( ctx . subject . level > ctx . entity . level ) then
- return actions . permit
- end
- return actions . notapplicable
- end
- local rules = { r0 = r1 }
- for _ , rule in pairs ( rules ) do
- local decision = rule ( ctx , actions , handlers )
- if decision == actions . permit then
- return actions . permit
- end
- end
- return actions . deny
- end
- end
- __example ( example )
- function __main ( ctx , actions , handlers )
- return example . Main ( ctx , actions , handlers )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement