Module:ArgsTNT

Jump to navigation Jump to search

Designed to create multilingual templates. Functions using Module:TNTTools and Module:SimpleArgs

Frame functions[edit source]

The name functions with suffix P take the name of the table from the template name. Otherwise you must use the functions with a suffix T that needs the TableN or the table name.

Value of an item in the table[edit source]

Where Id is the element's identifier in the table.

  • {{#invoke:ArgsTNT|StrP|Id}}
  • {{#invoke:ArgsTNT|StrT|TableN|Id}}

Creating a link to an article. If Always is true it will create the link even if the article does not exist.

  • {{#invoke:ArgsTNT|StrLnkP|Id|Always}}
  • {{#invoke:ArgsTNT|StrLnkT|TableN|Id|Always}}

Existence of parameters[edit source]

On Id1, etc. They are a variable number of parameter identifiers. Returns 1 if it finds Any or if there are All.

  • {{#invoke:ArgsTNT|ExistsAnyP|Id1|Id2...}}
  • {{#invoke:ArgsTNT|ExistsAnyT|TableN|Id1|Id2...}}
  • {{#invoke:ArgsTNT|ExistsAllP|Id1|Id2...}}
  • {{#invoke:ArgsTNT|ExistsAllT|TableN|Id1|Id2...}}

Parameter values[edit source]

  • When the function has a R as prefix it is that the values are required, in case of being omitted, an error message will be presented.
  • Val corresponds to a value or assignment using , where n is the parameter number.
  • Id is the parameter identifier in the table. The values returned by the table identifier can be one or more (then separated by '|').
  • Default is the value that will be assigned if it is defined.
  • OKEmpty indicates that it is accepted without value.
  • The mark * indicates that the parameter is optional.

Strings[edit source]

  • {{#invoke:ArgsTNT|Str_Par|Val|Default*}}
  • {{#invoke:ArgsTNT|Str_ParP|Id|Default*}}
  • {{#invoke:ArgsTNT|Str_ParT|TableN|Id|Default*}}
  • {{#invoke:ArgsTNT|RStr_Par|Val|Default*|OKEmpty*}}
  • {{#invoke:ArgsTNT|RStr_ParP|Id|Default*|OKEmpty*}}
  • {{#invoke:ArgsTNT|RStr_ParT|TableN|Id|OKEmpty*}}
Checking strings[edit source]
  • PossibleValsId is the identifier in the table of possible values separated by '|'.
  • CaseSens if is case-sensitive.
  • {{#invoke:ArgsTNT|StrChkTab_Par_P|Val|PossibleValsId|CaseSens*|Default*}}
  • {{#invoke:ArgsTNT|StrChkTab_Par_T|TableN|Val|PossibleValsId|CaseSens*|Default*}}
  • {{#invoke:ArgsTNT|StrChkTab_ParP|Id|PossibleValsId|CaseSens*|Default*}}
  • {{#invoke:ArgsTNT|StrChkTab_ParT|TableN|Id|PossibleValsId|CaseSens*|Default*}}
  • {{#invoke:ArgsTNT|RStrChkTab_Par_P|Val|PossibleValsId|CaseSens*|OKEmpty*}}
  • {{#invoke:ArgsTNT|RStrChkTab_Par_T|TableN|Val|PossibleValsId|CaseSens*|OKEmpty*}}
  • {{#invoke:ArgsTNT|RStrChkTab_ParP|Id|PossibleValsId|CaseSens*|OKEmpty*}}
  • {{#invoke:ArgsTNT|RStrChkTab_ParT|TableN|Id|PossibleValsId|CaseSens*|OKEmpty*}}

Numbers[edit source]

  • LimInf and LimSup indicate the minimum and maximum limits for the value of the parameter.

Of any type:

  • {{#invoke:ArgsTNT|Num_Par|Val|Default*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|Num_ParP|Id|Default*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|Num_ParT|TableN|Id|Default*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|RNum_Par|Val|OKEmpty*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|RNum_ParP|Id|OKEmpty*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|RNum_ParT|TableN|Id|OKEmpty*|LimInf*|LimSup*}}

Integers:

  • {{#invoke:ArgsTNT|Int_Par|Val|Default*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|Int_ParP|Id|Default*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|Int_ParT|TableN|Id|Default*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|RInt_Par|Val|OKEmpty*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|RInt_ParP|Id|OKEmpty*|LimInf*|LimSup*}}
  • {{#invoke:ArgsTNT|RInt_ParT|TableN|Id|OKEmpty*|LimInf*|LimSup*}}

Booleans[edit source]

They return a 1 if it is true or 0 if it is false, with the values:

  • True: Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value).
  • False: Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value).

Functions:

  • {{#invoke:ArgsTNT|Bool_Par|Val|Default*}}
  • {{#invoke:ArgsTNT|Bool_ParP|Id|Default*}}
  • {{#invoke:ArgsTNT|Bool_ParT|TableN|Id|Default*}}
  • {{#invoke:ArgsTNT|RBool_Par|Val|OKEmpty*}}
  • {{#invoke:ArgsTNT|RBool_ParP|Id|OKEmpty*}}
  • {{#invoke:ArgsTNT|RBool_ParT|TableN|Id|OKEmpty*}}

Searching string[edit source]

Boolean[edit source]

  • Wd is the word or phrase to look for. Finding it returns a 1, but a 0.
  • CaseSens if is case-sensitive.
  • {{#invoke:ArgsTNT|FoundStrBoolP|Wd|CaseSens|Id}}
  • {{#invoke:ArgsTNT|FoundStrBoolT|TableN|Wd|CaseSens|Id}}

Index[edit source]

Return the index. If he found Wd in Id1 returns a 1, if he found it in Id2 returns a 2 ... If he does not find Wd returns a 0.

  • {{#invoke:ArgsTNT|StrIdxChkTabP|Wd|CaseSens|Id1|Id2...}}
  • {{#invoke:ArgsTNT|StrIdxChkTabT|TableN|Wd|CaseSens|Id1|Id2...}}

Return an error message if it does not find Wd:

  • {{#invoke:ArgsTNT|StrIdxChkTabEP|Wd|CaseSens|Id1|Id2...}}
  • {{#invoke:ArgsTNT|StrIdxChkTabET|TableN|Wd|CaseSens|Id1|Id2...}}

Template documentation[edit source]

They functions are for use on the documentation page of the template.

These functions create a link to the table (in commons):

  • {{#invoke:ArgsTNT|LnkTNTTabP}}
  • {{#invoke:ArgsTNT|LnkTNTTabT|TableN}}

It shows the string from a table item, when it takes the name of the template (otherwise StrT must be used).

  • {{#invoke:ArgsTNT|StrNoEnd|Id}}

Examples[edit source]

Template:ArgsTNTExamples

External links[edit source]


local p = {}

local TNT = require('Module:TNT')
local TNTT = require('Module:TNTTools')
local SA = require('Module:SimpleArgs')
local SD = require('Module:SimpleDebug')
local yesno = require('Module:YesnoTNT')

local RS_SNotFoundInTab = 'SNotFoundInTab'
local function I18nStr (S, ...)
	return TNTT.GetMsgP ('SimpleArgs', S, {...})
end

function p.ParentTNTTab(frame)
	local S = frame:getParent():getTitle()
	return string.sub(S, string.find(S,':')+1)
end	

function p.TNTTabP (frame)
	local doc = p.ParentTNTTab(frame)
	doc = string.sub (doc, 1, #doc - doc:reverse():find("/"))
	return TNTT.TNTTabFull(doc)
end

function p.LnkTNTTabP (frame)
	return TNTT.LnkTNTTab (p.TNTTabP(frame))
end

function p.LnkTNTTabT (frame)
	local args = SA.GetArgs (frame)
	local TNTTab = SA.RStr_Par (args, 1)
	return TNTT.LnkTNTTab(TNTTab)
end

function GetTNTTab (frame, args, Inc)
	if SA.Error.yes then return end
	if Inc == 1 then
		return SA.RStr_Par (args, Inc)
	else
		return p.ParentTNTTab(frame)
	end
end --GetTNTTab

function Str0 (frame, Inc)
	local args, NArgs = SA.GetArgs (frame, true, true)
	local tab = SA.StrTab_NPar (args, NArgs, 2+Inc, nil, nil, 0)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local S = ''
	if not SA.Error.yes then
		S = TNTT.GetMsgP (TNTTab, args[1+Inc], unpack(tab))
	end	
	if SA.Error.yes then 
		return SA.MsgError()
	else
		return S
	end	
end --Str0

function p.StrNoEnd (frame)
	local args = SA.GetArgs (frame, true, true)
	local S = SA.RStr_Par (args, 1)
	return TNT.format (p.TNTTabP(frame), S)
end --StrNoEnd

function p.StrP (frame)
	return Str0 (frame, 0)
end

function p.StrT (frame)
	return Str0 (frame, 1)
end

function StrLnk0 (frame, Inc)
	local args, NArgs = SA.GetArgs (frame, true, true)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local S = SA.RStr_Par (args, 1+Inc)
	if not SA.Error.yes then
		S = TNT.format (TNTT.TNTTabFull(TNTTab), S)
	end	
	if SA.Error.yes then 
		return SA.MsgError()
	else
		local Always = SA.Bool_Par (args, 2+Inc)
		local titleObj = mw.title.new (S)
		if (titleObj and titleObj.exists) or Always then
			S = '[['..S..']]'
		end
		return S
	end	
end --StrLnk0

function p.StrLnkP (frame)
	return StrLnk0 (frame, 0)
end

function p.StrLnkT (frame)
	return StrLnk0 (frame, 1)
end

function ExistsAny (frame, Inc)
	local args, NArgs = SA.GetArgs (frame)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local tab = SA.StrTab_NPar (args, NArgs, 1+Inc, 1)
	local pargs = frame:getParent().args
	for v, w in ipairs(tab) do
		for j, k in pairs(pargs) do
			local num = tonumber(w)
			if not num then
				local tab2 = TNTT.TabTransCS (TNTTab, w)
				for l, m in ipairs(tab2) do
					if j == m then
						return 1
					end
				end
			else	
				if j == num then
					return 1
				end	
			end	
		end
	end
	return 0
end --ExistsAny	

function p.ExistsAnyP (frame)
	return ExistsAny (frame, 0) 
end

function p.ExistsAnyT (frame)
	return ExistsAny (frame, 1) 
end

function ExistsAll (frame, Inc)
	local args, NArgs = SA.GetArgs (frame)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local tab = SA.StrTab_NPar (args, NArgs, 1+Inc, 1)
	local pargs = frame:getParent().args
	for v, w in ipairs(tab) do
		local found = false
		for j, k in pairs(pargs) do
			local num = tonumber(w)
			if not num then
				local tab2 = TNTT.TabTransCS (TNTTab, w)
				for l, m in ipairs(tab2) do
					if j == m then
						found = true
						break
					end
				end
			else	
				if j == num then
					found = true
					break
				end	
			end	
			if found then
				break
			end	
		end
		if not found then
			return 0
		end	
	end
	return 1
end --ExistsAll	

function p.ExistsAllP (frame)
	return ExistsAll (frame, 0) 
end

function p.ExistsAllT (frame)
	return ExistsAll (frame, 1) 
end

----

function Str_Par00 (frame)
	local args = SA.GetArgs (frame, true, true)
	local S = SA.Str_Par (args, 1)
	return args, S
end --Str_Par00

function Str_Par01 (frame, Inc)
	local args, NArgs = SA.GetArgs (frame, true, true)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local S = SA.RStr_Par (args, 1+Inc)
	local tab = TNTT.TabTransCS (TNTTab, S)
	return args, tab
end --Str_Par01

function Str_ParArgs (frame, tab) 
	local pargs = frame:getParent().args
	for k, v in pairs(pargs) do
		for i, w in ipairs(tab) do
			if w == k then
				return mw.text.trim (v), k
			end	
		end
		if found then
			break
		end	
	end
	return nil, tab
end --Str_ParArgs

function p.Str_Par (frame)
	local args, S = Str_Par00 (frame)
	if (S == nil) or (S == '') then
		local Default = SA.Str_Par (args, 2, '')
		S = Default
	end
	return S
end --Str_Par

function Str_Par0 (frame, Inc)
	local args, tab = Str_Par01 (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		local S = Str_ParArgs (frame, tab)
		if (S == nil) or (S == '') then
			local Default = SA.Str_Par (args, 2+Inc, '')
			S = Default
		end
		return S
	end
end --Str_Par0	

function p.Str_ParP (frame)
	return Str_Par0 (frame, 0) 
end

function p.Str_ParT (frame)
	return Str_Par0 (frame, 1) 
end

function p.RStr_Par (frame)
	local args, S = Str_Par00 (frame)
	local OKEmpty = SA.Bool_Par (args, 2, nil)
	if (S == nil) or ((S == '') and ((OKEmpty == nil) or (not OKEmpty))) then
		SA.NotAssignedValue (k)
		return SA.MsgError() 
	else
		return S
	end
end --RStr_Par

function RStr_Par0 (frame, Inc)
	local args, tab = Str_Par01 (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		local S, k = Str_ParArgs (frame, tab) 
		local OKEmpty = SA.Bool_Par (args, 2+Inc, nil)
		if (S == nil) or ((S == '') and ((OKEmpty == nil) or (not OKEmpty))) then
			SA.NotAssignedValue (k)
			return SA.MsgError() 
		else
			return S
		end
	end	
end --RStr_Par0

function p.RStr_ParP (frame)
	return RStr_Par0 (frame, 0) 
end

function p.RStr_ParT (frame)
	return RStr_Par0 (frame, 1) 
end

----

function GetTab (args, TNTTab, Pos) 
	local S = SA.RStr_Par (args, Pos)
	return TNTT.TabTransCS (TNTTab, S)
end

function StrChkTab_ (frame, Inc)
	local S, args = SStr_Par00 (frame)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local tab2 = GetTab (args, TNTTab, 2+Inc)
	local CaseSens = SA.Bool_Par (args, 3+Inc)
	return args, S, tab2, CaseSens
end	--StrChkTab_

function StrChkTab (frame, Inc)
	local args = SA.GetArgs (frame, true, true)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local tab1 = GetTab (args, TNTTab, 1+Inc)
	local tab2 = GetTab (args, TNTTab, 2+Inc)
	local CaseSens = SA.Bool_Par (args, 3+Inc)
	return args, tab1, tab2, CaseSens
end	--StrChkTab

function StrChkTabEnd (k, S, tab2, CaseSens, Default)
	S = SA.StrChkTab_Par0 (k, S, tab2, CaseSens, Default)
	if SA.Error.yes then 
		return SA.MsgError()
	else
		return S
	end	
end --StrChkTabEnd

function StrChkTabPreEnd (args, k, S, tab2, CaseSens, Inc)
	local Default = SA.Str_Par (args, 4+Inc, '')
	if (S == nil) or (S == '') then
		return Default
	else
		return StrChkTabEnd (k, S, tab2, CaseSens, Default)
	end
end --StrChkTabPreEnd	

function RStrChkTabPreEnd (args, k, S, tab2, CaseSens, Inc)
	local OKEmpty = SA.Bool_Par (args, 4+Inc, nil)
	if (S == nil) or ((S == '') and ((OKEmpty == nil) or (not OKEmpty))) then
		SA.NotAssignedValue (1)
		return SA.MsgError() 
	else
		return StrChkTabEnd (k, S, tab2, CaseSens)
	end
end	--RStrChkTabPreEnd

function StrChkTab_Par_0 (frame, Inc) 
	local args, S, tab2, CaseSens = StrChkTab_ (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		return StrChkTabPreEnd (args, 1, S, tab2, CaseSens, Inc)
	end
end --StrChkTab_Par_0

function RStrChkTab_Par_0 (frame, Inc) 
	local args, S, tab2, CaseSens = StrChkTab_ (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		return RStrChkTabPreEnd (args, 1, S, tab2, CaseSens, Inc)
	end	
end --RStrChkTab_Par_0

function p.StrChkTab_Par_P (frame)
	return StrChkTab_Par_0 (frame, 0) 
end

function p.StrChkTab_Par_T (frame)
	return StrChkTab_Par_0 (frame, 1) 
end

function p.RStrChkTab_Par_P (frame)
	return RStrChkTab_Par_0 (frame, 0) 
end

function p.RStrChkTab_Par_T (frame)
	return RStrChkTab_Par_0 (frame, 1) 
end

function StrChkTab_Par0 (frame, Inc) 
	local args, tab1, tab2, CaseSens = StrChkTab (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		local S, k = Str_ParArgs (frame, tab1)
		return StrChkTabPreEnd (args, k, S, tab2, CaseSens, Inc)
	end
end --StrChkTab_Par0

function RStrChkTab_Par0 (frame, Inc) 
	local args, tab1, tab2, CaseSens = StrChkTab (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		local S, k = Str_ParArgs (frame, tab1) 
		return RStrChkTabPreEnd (args, k, S, tab2, CaseSens, Inc)
	end	
end --RStrChkTab_Par0

function p.StrChkTab_ParP (frame)
	return StrChkTab_Par0 (frame, 0) 
end

function p.StrChkTab_ParT (frame)
	return StrChkTab_Par0 (frame, 1) 
end

function p.RStrChkTab_ParP (frame)
	return RStrChkTab_Par0 (frame, 0) 
end

function p.RStrChkTab_ParT (frame)
	return RStrChkTab_Par0 (frame, 1) 
end

----

function CheckSIsNum (S, args, k, Inc)
	if S == nil then
		return S, false
	else
		LimInf = SA.Num_Par (args, 3+Inc)
		LimSup = SA.Num_Par (args, 4+Inc)
		SA.CheckSIsNum (S, {k}, LimInf, LimSup)
		if SA.Error.yes then 
			return SA.MsgError(), false, nil 
		else	
			return tonumber(S), true, k
		end	
	end
end --CheckSIsNum

function WithNum (args, N, k, Inc)
	if (N == nil) or (N == '') then
		local Default = SA.Num_Par (args, 2+Inc, nil)
		if Default ~= nil then
			return Default, true, k
		else
			return nil, false, k
		end
	else	
		return CheckSIsNum (N, args, k, Inc)
	end
end --WithNum

function Num_ParX (frame)
	local args, N = Str_Par00 (frame)
	local Valid, k
	N, Valid, k = WithNum (args, N, 1, 0)
	return N, Valid, k
end

function p.Num_Par (frame)
	local N, Valid, k = Num_ParX (frame) 
	return N
end 

function Num_Par0 (frame, Inc)
	local args, tab = Str_Par01 (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError(), false, nil 
	else
		local N, k = Str_ParArgs (frame, tab)
		return WithNum (args, N, k, Inc)
	end
end --Num_Par0	

function p.Num_ParP (frame)
	local N, Valid, k = Num_Par0 (frame, 0) 
	return N
end

function p.Num_ParT (frame)
	local N, Valid, k = Num_Par0 (frame, 1) 
	return N
end

function WithRNum  (args, N, k, Inc)
	local OKEmpty = SA.Bool_Par (args, 2+Inc, nil)
	if (N == nil) or ((N == '') and ((OKEmpty == nil) or (not OKEmpty))) then
		SA.NotAssignedValue (k)
		return SA.MsgError()
	else	
		return CheckSIsNum (N, args, k, Inc)
	end
end	--WithRNum

function RNum_ParX (frame)
	local args, N = Str_Par00 (frame)
	return WithRNum (args, N, 1, 0)
end

function p.RNum_Par (frame)
	local N, Valid, k = RNum_ParX (frame) 
	return N
end --RNum_Par

function RNum_Par0 (frame, Inc)
	local args, tab = Str_Par01 (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError(), false, nil 
	else
		local N, k = Str_ParArgs (frame, tab)
		return WithRNum (args, N, k, Inc)
	end
end --RNum_Par0	

function p.RNum_ParP (frame)
	local N, Valid, k = RNum_Par0 (frame, 0) 
	return N
end

function p.RNum_ParT (frame)
	local N, Valid, k = RNum_Par0 (frame, 1) 
	return N
end

function WithInt (N, Valid, k)
	if Valid then
		SA.CheckNumIsInt (N, {k})
		if SA.Error.yes then 
			return SA.MsgError()
		else	
			return N
		end	
	else
		return N
	end	
end --WithInt	

function p.Int_Par (frame)
	local N, Valid, k = Num_ParX (frame) 
	return WithInt (N, Valid, k)
end

function Int_Par0 (frame, Inc)
	local N, Valid, k = Num_Par0 (frame, Inc)
	return WithInt (N, Valid, k)
end	

function p.Int_ParP (frame)
	return Int_Par0 (frame, 0) 
end

function p.Int_ParT (frame)
	return Int_Par0 (frame, 1) 
end

function p.RInt_Par (frame)
	local N, Valid, k = RNum_ParX (frame) 
	return WithInt (N, Valid, k)
end

function RInt_Par0 (frame, Inc)
	local N, Valid, k = RNum_Par0 (frame, Inc)
	return WithInt (N, Valid, k)
end

function p.RInt_ParP (frame)
	return RInt_Par0 (frame, 0) 
end

function p.RInt_ParT (frame)
	return RInt_Par0 (frame, 1) 
end

----

function Bool0 (B, Default)
	local Bool = yesno (B, Default)
	if Bool == nil then
		return nil
	elseif Bool or (Bool == 1) then 
		return 1
	else
		return 0
	end
end	--Bool0

function Bool_Par (frame, func)
	local args = SA.GetArgs (frame, true, true)
	local B = func (args)
	if SA.Error.yes then 
		return SA.MsgError()
	else	
		local Default = SA.Int_Par (args, 2)
		return Bool0 (B, Default)
	end	
end --Bool_Par

function Bool_Par0 (frame, Inc)
	local args, tab = Str_Par01 (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		local B = Str_ParArgs (frame, tab)
		local Default = SA.Int_Par (args, 2+Inc)
		return Bool0 (B, Default)
	end
end --Bool_Par0	

function RBool_Par0 (frame, Inc)
	local args, tab = Str_Par01 (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	else
		local B, k = Str_ParArgs (frame, tab)
		local OKEmpty = SA.Bool_Par (args, 2+Inc, nil)
		B = Bool0 (B)
		if (B == nil) and ((OKEmpty == nil) or (not OKEmpty)) then
			SA.NotAssignedValue (k)
			return SA.MsgError()
		else
			return B
		end	
	end
end --RBool_Par0	

function BoolFromArg (args)
	return SA.Str_Par (args, 1)
end	

function RBoolFromArg (args)
	return SA.RStr_Par (args, 1)
end	

function p.Bool_Par (frame)
	return Bool_Par (frame, BoolFromArg)
end

function p.Bool_ParP (frame)
	return Bool_Par0 (frame, 0)
end

function p.Bool_ParT (frame)
	return Bool_Par0 (frame, 1)
end

function p.RBool_Par (frame)
	return Bool_Par (frame, RBoolFromArg)
end

function p.RBool_ParP (frame)
	return RBool_Par0 (frame, 0)
end

function p.RBool_ParT (frame)
	return RBool_Par0 (frame, 1)
end

----

local function ArgsTNTTabWd (frame, Inc)
	local args, NArgs = SA.GetArgs (frame, true, true)
	local TNTTab = GetTNTTab (frame, args, Inc)
	local Wd = SA.RStr_Par (args, 1+Inc)
	local CaseSens = SA.RBool_Par (args,2+Inc)
	return args, NArgs, TNTTab, Wd, CaseSens
end --ArgsTNTTabWd

function FoundStrBool (frame, Inc)
	local args, NArgs, TNTTab, Wd, CaseSens = ArgsTNTTabWd (frame, Inc)
	local Bool = false
	if not SA.Error.yes then 
		Bool = TNTT.SFoundInTNTArr (TNTTab, Wd, CaseSens, args[4])
	end	
	if SA.Error.yes then 
		return SA.MsgError()
	elseif Bool then 
		return 1
	else
		return 0
	end
end --FoundStrBool
	
function p.FoundStrBoolP (frame)
	return FoundStrBool (frame, 0)  
end

function p.FoundStrBoolT (frame)
	return FoundStrBool (frame, 1)  
end

function StrIdxChkTab (frame, Inc)
	local args, NArgs, TNTTab, Wd, CaseSens = ArgsTNTTabWd (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	end
	local tab = SA.StrTab_NPar (args, NArgs, 3+Inc, 1, nil, 0)
	local Idx = 0
	if not SA.Error.yes then 
		Idx = TNTT.IdxFromTabTrans (TNTTab, Wd, CaseSens, tab)
	end	
	if SA.Error.yes then 
		return SA.MsgError()
	else
		return Idx
	end	
end --StrIdxChkTab

function p.StrIdxChkTabP (frame)
	return StrIdxChkTab (frame, 0)  
end

function p.StrIdxChkTabT (frame)
	return StrIdxChkTab (frame, 1)  
end
	
function StrIdxChkTabE (frame, Inc)
	local args, NArgs, TNTTab, Wd, CaseSens = ArgsTNTTabWd (frame, Inc)
	if SA.Error.yes then 
		return SA.MsgError() 
	end
	local tab = SA.StrTab_NPar (args, NArgs, 3+Inc, 1, nil, 0)
	local Val = 0
	if not SA.Error.yes then 
		Val = TNTT.IdxFromTabTrans (TNTTab, Wd, CaseSens, tab)
	end	
	if SA.Error.yes then 
		return SA.MsgError()
	else
		if Val == 0 then
			local S = ''
			for I, W in ipairs(tab) do
				if S ~='' then
					S = S..', '
				end	
				S = S..table.concat (TNTT.TabTransCS(TNTTab,W), SA.ParaSep)
			end
			SA.MsgError(I18nStr (RS_SNotFoundInTab, Wd, S))
			return SA.MsgError()
		else	
			return Val
		end	
	end	
end --StrIdxChkTabE

function p.StrIdxChkTabEP (frame)
	return StrIdxChkTabE (frame, 0)  
end

function p.StrIdxChkTabET (frame)
	return StrIdxChkTabE (frame, 1)  
end

return p