Module:ValComp

From Exiled Kingdoms Wiki
Revision as of 19:28, 7 June 2017 by M3lkor (talk | contribs) (Created page with "function Compare(Arg1, Symb, Arg2) result = false if (Symb == 'gt' or Symb == '>') then if (tonumber(Arg1) > tonumber(Arg2)) then resul...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

function Compare(Arg1, Symb, Arg2)

   result = false
       if (Symb == 'gt' or Symb == '>') then
           if (tonumber(Arg1) > tonumber(Arg2)) then
               result = true
           end
       elseif (Symb == 'lt' or Symb == '<') then
           if (tonumber(Arg1) < tonumber(Arg2)) then
               result = true
           end
       elseif (Symb == 'ge' or Symb == '>=') then
           if (tonumber(Arg1) >= tonumber(Arg2)) then
               result = true
           end
       elseif (Symb == 'le' or Symb == '<=') then
           if (tonumber(Arg1) <= tonumber(Arg2)) then
               result = true
           end
       elseif (Symb == 'eq' or Symb == '=') then
           if (tonumber(Arg1) == tonumber(Arg2)) then
               result = true
           end
       elseif (Symb == 'ne' or Symb == '!=') then
           if (tonumber(Arg1) ~= tonumber(Arg2)) then
               result = true
           end
       end
   return result

end