Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local lib = require ( ’ angine / lib / alfa ’)
  2. local __test = lib . test
  3. local __subseteq = lib . subseteq
  4. local __issubseteq = lib . issubseteq
  5. local __iselement = lib . iselement
  6.  
  7. local example = {}
  8.  
  9. local __example = function ( example )
  10.     function example . Main ( ctx , actions , handlers )
  11.         if not ctx . action then
  12.             return actions . indeterminate
  13.         end
  14.         if not ( ctx . action == " select " ) then
  15.             return actions . notapplicable
  16.         end
  17.  
  18.         local function r1 ( ctx , actions , handlers )
  19.             if not ctx . entity . level or not ctx . subject . level then
  20.                 return actions . indeterminate
  21.             end
  22.             if ( ctx . subject . level > ctx . entity . level ) then
  23.                 return actions . permit
  24.             end
  25.             return actions . notapplicable
  26.         end
  27.  
  28.         local rules = { r0 = r1 }
  29.         for _ , rule in pairs ( rules ) do
  30.             local decision = rule ( ctx , actions , handlers )
  31.             if decision == actions . permit then
  32.                 return actions . permit
  33.             end
  34.         end
  35.         return actions . deny
  36.     end
  37. end
  38.  
  39. __example ( example )
  40.  
  41. function __main ( ctx , actions , handlers )
  42.     return example . Main ( ctx , actions , handlers )
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement