Complete implementation of logical operators in gdt expressions - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/expr-print.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2013年05月15日 18:16:07 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2013年05月15日 18:16:07 +0200
commit37b7f1b367d40d544d1db65278e73c8f4a9decaf (patch)
treef65f3027e48668211499e2047257e8983cfb1668 /expr-print.lua
parent8609bf03ac6479678c489c559a8596ef6488af20 (diff)
downloadgsl-shell-37b7f1b367d40d544d1db65278e73c8f4a9decaf.tar.gz
Complete implementation of logical operators in gdt expressions
Diffstat (limited to 'expr-print.lua')
-rw-r--r--expr-print.lua 5
1 files changed, 5 insertions, 0 deletions
diff --git a/expr-print.lua b/expr-print.lua
index 4c73f44d..543ee58a 100644
--- a/expr-print.lua
+++ b/expr-print.lua
@@ -66,6 +66,11 @@ local function eval_operator(op, a, b)
elseif op == '=' then return (a == b and 1 or 0)
elseif op == '>' then return (a > b and 1 or 0)
elseif op == '<' then return (a < b and 1 or 0)
+ elseif op == '!=' then return (a ~= b and 1 or 0)
+ elseif op == '>=' then return (a >= b and 1 or 0)
+ elseif op == '<=' then return (a <= b and 1 or 0)
+ elseif op == 'AND' then return ((a ~= 0 and b ~= 0) and 1 or 0)
+ elseif op == 'OR' then return ((a ~= 0 or b ~= 0) and 1 or 0)
else error('unkown operation: ' .. op) end
end
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月12日 02:47:41 +0000

AltStyle によって変換されたページ (->オリジナル) /