summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luatruthtable/luatruthtable.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/luatruthtable/luatruthtable.sty')
-rw-r--r--macros/luatex/latex/luatruthtable/luatruthtable.sty68
1 files changed, 50 insertions, 18 deletions
diff --git a/macros/luatex/latex/luatruthtable/luatruthtable.sty b/macros/luatex/latex/luatruthtable/luatruthtable.sty
index 1b940c48c9..7f57bbe254 100644
--- a/macros/luatex/latex/luatruthtable/luatruthtable.sty
+++ b/macros/luatex/latex/luatruthtable/luatruthtable.sty
@@ -1,9 +1,9 @@
% luaset package
-% version 1.0
+% version 1.1
% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
%Authors: Chetan Shirore and Dr. Ajit Kumar
-\ProvidesPackage{luatruthtable}[1.0]
+\ProvidesPackage{luatruthtable}[1.1]
\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{luacode}
@@ -42,14 +42,18 @@ end
local tmp1 = {}
local logand = {}
+local v1 = 0
local and_mt= {
__mul = function(a,b)
if b==logand then
- tmp1[1]=a
+ v1 = v1 + 1
+ tmp1[v1]=a
return tmp1
elseif a == tmp1 then
- return _and(tmp1[1], b)
+ local w1 = _and(tmp1[v1], b)
+ v1 = v1 - 1
+ return w1
end
end
}
@@ -65,14 +69,18 @@ end
local tmp2 = {}
local logor = {}
+local v2 = 0
local or_mt= {
__mul = function(a,b)
if b==logor then
- tmp2[1]=a
+ v2 = v2 + 1
+ tmp2[v2] = a
return tmp2
elseif a == tmp2 then
- return _or(tmp2[1], b)
+ local w2 = _or(tmp2[v2], b)
+ v2 = v2 - 1
+ return w2
end
end
}
@@ -88,14 +96,18 @@ end
local tmp3 = {}
local imp = {}
+local v3 = 0
local imp_mt= {
__mul = function(a,b)
if b==imp then
- tmp3[1]=a
+ v3 = v3 + 1
+ tmp3[v3]=a
return tmp3
elseif a == tmp3 then
- return _imp(tmp3[1], b)
+ local w3 = _imp(tmp3[v3], b)
+ v3 = v3 - 1
+ return w3
end
end
}
@@ -111,14 +123,18 @@ end
local tmp4 = {}
local iff = {}
+local v4 = 0
local iff_mt= {
__mul = function(a,b)
if b==iff then
- tmp4[1]=a
+ v4 = v4 + 1
+ tmp4[v4]=a
return tmp4
elseif a == tmp4 then
- return _iff(tmp4[1], b)
+ local w4 = _iff(tmp4[v4], b)
+ v4 = v4 - 1
+ return w4
end
end
}
@@ -134,14 +150,18 @@ end
local tmp5 = {}
local logxor = {}
+local v5 = 0
local xor_mt= {
__mul = function(a,b)
if b==logxor then
- tmp5[1]=a
+ v5 = v5 + 1
+ tmp5[v5]=a
return tmp5
elseif a == tmp5 then
- return _xor(tmp5[1], b)
+ local w5 = _xor(tmp5[v5], b)
+ v5 = v5 - 1
+ return w5
end
end
}
@@ -157,14 +177,18 @@ end
local tmp6 = {}
local lognand = {}
+local v6 = 0
local nand_mt= {
__mul = function(a,b)
if b==lognand then
- tmp6[1]=a
+ v6 = v6 + 1
+ tmp6[v6]=a
return tmp6
elseif a == tmp6 then
- return _nand(tmp6[1], b)
+ local w6 = _nand(tmp6[v6], b)
+ v6 = v6 - 1
+ return w6
end
end
}
@@ -180,14 +204,18 @@ end
local tmp7 = {}
local lognor = {}
+local v7 = 0
local nor_mt= {
__mul = function(a,b)
if b==lognor then
- tmp7[1]=a
+ v7 = v7 + 1
+ tmp7[v7]=a
return tmp7
elseif a == tmp7 then
- return _nor(tmp7[1], b)
+ local w7 = _nor(tmp7[v7], b)
+ v7 = v7 - 1
+ return w7
end
end
}
@@ -203,14 +231,18 @@ end
local tmp8 = {}
local logxnor = {}
+local v8 = 0
local xnor_mt= {
__mul = function(a,b)
if b==logxnor then
- tmp8[1]=a
+ v8 = v8 + 1
+ tmp8[v8]=a
return tmp8
elseif a == tmp8 then
- return _xnor(tmp8[1], b)
+ local w8 = _xnor(tmp8[v8], b)
+ v8 = v8 - 1
+ return w8
end
end
}