MODULO
Memtesto disponeblas sur la dokumentaĵa subpaĝo.
Ĉi tiu modulo estas multfoje bindita.
Se vi konas la eblajn sekvojn, tiam vi povas zorgeme ekredakti.
Se vi ne kuraĝas redakti tiam vi povas proponi la deziratan ŝanĝon en la diskutejo.



--[===[

MODULE "MLILI" (lingvokodo ligilo)

"eo.wiktionary.org/wiki/Modulo:mlili" <!--2023-Nov-18-->

Purpose: converts language code to language name (with some bonus features)
         and optionally brews a link according to one of many available types

Utilo: konvertas lingvokodon al lingvomono (kun kelkaj bonusaj funkcioj)
       kaj opcie kreas ligilon laux unu inter multaj disponeblaj tipoj

Manfaat: mengonversi kode bahasa ke nama bahasa (dengan beberapa fungsi
         tambah) dan ...

Syfte: konverterar spraakkod till spraakets namn (med ...)

Used by templates / Uzata far sxablonoj:
- only "lili" (not to be called from any other place)

Required submodules / Bezonataj submoduloj / Submodul yang diperlukan:
- "loaddata-tbllingvoj" T76 in turn requiring template "tbllingvoj" (EO)
- "loaddata-tblbahasa" T76 in turn requiring template "tblbahasa" (ID)

This module can accept parameters whether sent to itself (own frame) or
to the caller (caller's frame). If there is a parameter "caller=true"
on the own frame then that own frame is discarded in favor of the
caller's one. Empty parameters and parameters longer than 160
octet:s are (except "noc=") inherently invalid (#E06), further
checks follow.

Parameters: (1...10)
            - 1 anonymous obligatory parameter
              - language code ("??" permitted)                                  !!!FIXME!!!
            - 0...9 named optional parameters
              - "tip=" - base type of output or link, 3 possible values: "LA",
                         "LK" (visible link to category), "KE" (cat insertion,
                         adding page into category), default is "raw" plain
                         text no link
              - "nem=" - 1 possible value: "1", avoid wall in the link, show
                         it plain and honest, default is wall with type
                         "LA" or "LK" but not with "KE", only legal with
                         base type "LA" or "LK" (otherwise error), not
                         together with "mon=" or "maj=1" (otherwise error)
              - "mon=" - type of language name, 4 possible values: "la" (add
                         "la" if appropriate), "aj" (brew adjective), "sf"
                         ("senfinajxa" ie without ending for example "kore",
                         does not work with all languages), "av" (brew adverb,
                         if one word then this is "mon=" type "sf" plus "e",
                         else this is string "en" plus space + "mon=" type
                         "la"), "pl" (brew plural adjective, works for sane
                         multiword language names too), default is native
                         ie SB or AJ and no "la", only legal
                         with base type "LA" or "LK" or "raw"
                         (otherwise error), not together with "nem=1" or
                         "prf=" (otherwise error)
              - "maj=" - 1 possible value: "1", force begin uppercase, default
                         false ie native case for "mon=" types native and
                         "la", and lowercase for "mon=" types "aj" "sf"
                         "av", only legal with base type "LA" or "LK" or
                         "raw" (otherwise error), not together
                         with "nem=1" (otherwise error)
              - "hin=" - string (2...80 octet:s), name of category, language
                         name will become the sorting hint/key all lowercase
                         and without spaces and dashes, name of category
                         is fixed, default no hint, only legal with base
                         type "KE" (otherwise error), not together with
                         "prf=" (otherwise error)
              - "prf=" - string (2...80 octet:s), add prefix before language
                         name and brackets, default no prefix, only legal with
                         base type "LA" or "LK" or "KE" (otherwise error), not
                         together with "mon=" or "hin=" (otherwise error)
              - "noc=" - 1 possible value: "true" (any other value ignored),
                         "true" causes empty result with "KE" ie suppresses
                         categorization, only useful with base type "KE"
                         (otherwise ignored), forward "nocat=" to this
                         one if desired
              - "per=" - 1 possible value: "1", keep link or category if
                         language code is bad (obviously invalid or unknown),
                         default is off and means to switch base
                         type "LA" or "LK" to type "raw", base
                         type "KE" to empty result, only legal with
                         base type "LA" or "LK" or "KE" (otherwise error)
              - "err=" - string (2...80 octet:s), common placeholder, by
                         default the errors are "evidente nevalida lingvokodo"
                         and "nekonata lingvokodo"

* parameter "noc=" cannot cause an error
* parameters "mon=" "maj=1" and on the other side "hin=" indirectly exclude
  each other absolutely via the base type
* for base type "KE" the language can be in the cat insertion target or
  in the hint, but not in both
* for types "LA" and "LK" the language can be in the single common field
  (with "nem=1"), or in both, but separately processed ("mon=" and "maj=1
  affect only the visible part)
* wikilink target or category name for "LA" "LK" "KE" always gets
  uppercase beginning letter
* sorting hint/key is always converted to lowercase (all letters) and junk
  char:s (particularly spaces and dashes) are removed
* if language code is bad (obviously invalid or unknown) then by default
  both "tip=" and "mon=" are force-switched to default values "raw" and
  "native", yet with "per=1" the result is constructed with "tip="
  unaffected but "mon=" still force-switched to "native"

Returned: - one moderately long string with raw name or link, can be empty
            in some cases, or red error message

This module is unbreakable (when called with correct module name
and function name). Every imaginable input from the caller and
from the imported modules will output either a useful result or
at least a helpful error string.

Cxi tiu modulo estas nerompebla (kiam vokita kun gxustaj nomo de modulo
kaj nomo de funkcio). Cxiu imagebla enigo de la vokanto kaj
de la importataj moduloj eldonos aux utilan rezulton aux
almenaux helpeman eraranoncan signocxenon.

Following errors are possible:
* <<#E01 Internal error in module "mlili">>
  Possible causes:
  * strings not uncommented
* <<#E02 Malica eraro en subprogramaro uzata far sxablono "lili">>
  Possible causes:
  * submodule not found
  * submodule caused unspecified failure
* <<#E03 Nombrigita eraro en subprogramaro uzata far sxablono "lili">>
  Possible causes:
  * submodule failed and returned valid error code
* <<#E06 Erara uzo de sxablono "lili", legu gxian dokumentajxon>>
  Possible causes (early detected obvious problems with parameters):
  * one obligatory anonymous parameter missing
  * more than one anonymous parameter supplied
  * empty parameters or parameters longer than 160 octet:s (except for "noc=")
* <<#E08 Nevalida baza tipo "tip=" en sxablono "lili">>
* <<#E09 Nevalida signocxeno "hin=" "prf=" "err=" en sxablono "lili">>
  Possible causes:
  * string length out of range (2...80 octet:s)
* <<#E10 Erara uzo de sxablono "lili" pro parametroj>>
  Possible causes (later detected more clandestine problems with parameters):
  * bad value of a single parameter not caught by #E06 #E08 #E09
  * conflicting parameters
Note that obviously invalid or unknown language code is NOT an error here.

{{hr3}} <!-------------------------------->

* #T00 ("", no params, evil)
* expected result: #E06
* actual result: "{{#invoke:mlili|ek}}"

::* #T01 ("eo|vo", two anonymous params, evil)
::* expected result: #E06
::* actual result: "{{#invoke:mlili|ek|eo|vo}}"

* #T02 ("vo", simplest example, native SB)
* expected result: "Volapuko"
* actual result: "{{#invoke:mlili|ek|vo}}"

::* #T03 ("ko", simplest example, native AJ)
::* expected result: "korea"
::* actual result: "{{#invoke:mlili|ek|ko}}"

* #T04 ("io|mon=la", raw, add "la" if needed from native SB)
* expected result: "Ido"
* actual result: "{{#invoke:mlili|ek|io|mon=la}}"

::* #T05 ("sv|mon=la", raw, add "la" if needed from native AJ)
::* expected result: "la sveda"
::* actual result: "{{#invoke:mlili|ek|sv|mon=la}}"

* #T06 ("sma|mon=la", raw, add "la" if needed from native AJ multiword)
* expected result: "la samea suda"
* actual result: "{{#invoke:mlili|ek|sma|mon=la}}"

{{hr3}} <!-------------------------------->

* #T10 ("io|mon=aj", raw, force AJ from native SB)
* expected result: "ida"
* actual result: "{{#invoke:mlili|ek|io|mon=aj}}"

::* #T11 ("sv|mon=aj", raw, force AJ from native AJ)
::* expected result: "sveda"
::* actual result: "{{#invoke:mlili|ek|sv|mon=aj}}"

* #T12 ("sma|mon=aj", raw, force AJ from native AJ multiword)
* expected result: "samea suda"
* actual result: "{{#invoke:mlili|ek|sma|mon=aj}}"

::* #T13 ("io|mon=sf", raw, force root from native SB)
::* expected result: "id" (note that this is name "Ido", not code "id")
::* actual result: "{{#invoke:mlili|ek|io|mon=sf}}"

* #T14 ("sv|mon=sf", raw, force root from native AJ)
* expected result: "sved"
* actual result: "{{#invoke:mlili|ek|sv|mon=sf}}"

::* #T15 ("sma|mon=sf", raw, force root from native AJ multiword)
::* expected result: "samea sud" (useless)
::* actual result: "{{#invoke:mlili|ek|sma|mon=sf}}"

* #T16 ("sv|mon=pl", raw, force AJ and plural from native AJ)
* expected result: "svedaj"
* actual result: "{{#invoke:mlili|ek|sv|mon=pl}}"

::* #T17 ("sma|mon=pl", raw, force AJ and plural from native AJ multiword)
::* expected result: "sameaj sudaj"
::* actual result: "{{#invoke:mlili|ek|sma|mon=pl}}"

* #T18 ("sa|mon=pl", raw, force AJ and plural from native SB)
* expected result: "sanskritaj"
* actual result: "{{#invoke:mlili|ek|sa|mon=pl}}"

{{hr3}} <!-------------------------------->

* #T20 ("io|mon=av", raw, force AV from native SB)
* expected result: "ide"
* actual result: "{{#invoke:mlili|ek|io|mon=av}}"

::* #T21 ("sv|mon=av", raw, force AV from native AJ)
::* expected result: "svede"
::* actual result: "{{#invoke:mlili|ek|sv|mon=av}}"

* #T22 ("sma|mon=av", raw, force AV from native AJ multiword)
* expected result: "en la samea suda" (fake AV by PP "en", is useful again)
* actual result: "{{#invoke:mlili|ek|sma|mon=av}}"

::* #T23 ("io|mon=av|maj=1", raw, force AV from native SB and uppercase)
::* expected result: "Ide"
::* actual result: "{{#invoke:mlili|ek|io|mon=av|maj=1}}"

* #T24 ("sv|mon=av|maj=1", raw, force AV from native AJ and uppercase)
* expected result: "Svede"
* actual result: "{{#invoke:mlili|ek|sv|mon=av|maj=1}}"

::* #T25 ("sma|mon=av|maj=1", raw, force AV from native AJ multiword and uppercase)
::* expected result: "En la samea suda" (fake AV by PP "en", is useful again)
::* actual result: "{{#invoke:mlili|ek|sma|mon=av|maj=1}}"

{{hr3}} <!-------------------------------->

* #T30 ("eo|tip=LA", simple example, native SB)
* expected result: link to "Aldono:Esperanto" with text "Esperanto"
* actual result: "{{#invoke:mlili|ek|eo|tip=LA}}"

::* #T31 ("ko|tip=LA", simple example, native AJ)
::* expected result: link to "Aldono:Korea" with text "korea" (note the letter case)
::* actual result: "{{#invoke:mlili|ek|ko|tip=LA}}"

* #T32 ("eo|tip=LK", simple example, native SB)
* expected result: link to "Kategorio:Esperanto" with hidden colon ":"
* actual result: "{{#invoke:mlili|ek|eo|tip=LK}}"
* actual result via debu: "{{debu|{{#invoke:mlili|ek|eo|tip=LK}}|outctl=nw}}"

::* #T33 ("ko|tip=LK", simple example, native AJ)
::* expected result: link to "Kategorio:Korea" with hidden colon ":"
::* actual result: "{{#invoke:mlili|ek|ko|tip=LK}}"
::* actual result via debu: "{{debu|{{#invoke:mlili|ek|ko|tip=LK}}|outctl=nw}}"

* #T34 ("sma|tip=LK|mon=pl", force AJ and plural from native AJ multiword)
* expected result: link to "Kategorio:Samea suda" with hidden colon ":" and text "sameaj sudaj"
* actual result: "{{#invoke:mlili|ek|sma|tip=LK|mon=pl}}"
* actual result via debu: "{{debu|{{#invoke:mlili|ek|sma|tip=LK|mon=pl}}|outctl=nw}}"

{{hr3}} <!-------------------------------->

* #T40 ("vo|tip=KE", simple example, native SB)
* expected result: sube "Kategorio:Volapuko"
* actual result: "{ {#invoke:mlili|ek|vo|tip=KE} }" (blocked)
* actual result via debu: "{{debu|{{#invoke:mlili|ek|vo|tip=KE}}|outctl=nw}}"

::* #T41 ("ko|tip=KE", simple example, native AJ)
::* expected result: sube "Kategorio:Korea"
::* actual result: "{ {#invoke:mlili|ek|ko|tip=KE} }" (blocked)
::* actual result via debu: "{{debu|{{#invoke:mlili|ek|ko|tip=KE}}|outctl=nw}}"

* #T42 ("ia|tip=KE|hin=Fivortaro", native SB, supply cat name and use hint)
* expected result: sube "Kategorio:Fivortaro" with hint "interlingvao"
* actual result: "{ {#invoke:mlili|ek|ia|tip=KE|hin=Fivortaro} }" (blocked)
* actual result via debu: "{{debu|{{#invoke:mlili|ek|ia|tip=KE|hin=Fivortaro}}|outctl=nw}}"

::* #T43 ("ko|tip=KE|hin=Fivortaro", native AJ, supply cat name and use hint)
::* expected result: sube "Kategorio:Fivortaro" with hint "korea"
::* actual result: "{ {#invoke:mlili|ek|ko|tip=KE|hin=Fivortaro} }" (blocked)
::* actual result via debu: "{{debu|{{#invoke:mlili|ek|ko|tip=KE|hin=Fivortaro}}|outctl=nw}}"

{{hr3}} <!-------------------------------->

* note that tests #T32 ... #T34 and #T40 ... #T43 depend on "debu"
* note that tests #T40 ... #T43 cannot be reasonably executed on the docs subpage without help of "pate" or "debu"

{{hr3}} <!-------------------------------->

]===]

local exporttable = {}

------------------------------------------------------------------------

---- CONSTANTS [O] ----

------------------------------------------------------------------------

  -- uncommentable EO vs ID constant strings (core site-related features)

  local constrpriv = "eo"                            -- EO (privileged site language)
  -- local constrpriv = "id"                            -- ID (privileged site language)
  local constringvoj = "Modulo:loaddata-tbllingvoj"  -- EO
  -- local constringvoj = "Modul:loaddata-tblbahasa"    -- ID
  local constrkatp = 'Kategorio:'         -- EO namespace prefix (incl colon ":")
  -- local constrkatp = 'Kategori:'          -- ID namespace prefix (incl colon ":")
  local constraldp = 'Aldono:'            -- EO namespace prefix (incl colon ":")
  -- local constraldp = 'Lampiran:'          -- ID namespace prefix (incl colon ":")

  -- constant table -- ban list -- add obviously invalid access codes (2-letter or 3-letter) only

  -- length of the list is NOT stored anywhere, the processing stops
  -- when type "nil" is encountered, used by "lfivalidatelnkoadv" only

  -- controversial codes (sh sr hr), (zh cmn)
  -- "en.wiktionary.org/wiki/Wiktionary:Language_treatment" excluded languages
  -- "en.wikipedia.org/wiki/Spurious_languages"
  -- "iso639-3.sil.org/code/art" only valid in ISO 639-2
  -- "iso639-3.sil.org/code/gem" only valid in ISO 639-2 and 639-5, "collective"
  -- "iso639-3.sil.org/code/zxx" "No linguistic content"

  local contabisbanned = {}
  contabisbanned = {'by','dc','ll','jp','art','deu','eng','epo','fra','gem','ger','ido','lat','por','rus','spa','swe','tup','zxx'} -- 1...19

  -- surrogate transcoding table (only needed for EO)

  local contabtransluteo = {}
  contabtransluteo[ 67] = 0xC488 -- CX
  contabtransluteo[ 99] = 0xC489 -- cx
  contabtransluteo[ 71] = 0xC49C -- GX
  contabtransluteo[103] = 0xC49D -- gx
  contabtransluteo[ 74] = 0xC4B4 -- JX
  contabtransluteo[106] = 0xC4B5 -- jx
  contabtransluteo[ 83] = 0xC59C -- SX
  contabtransluteo[115] = 0xC59D -- sx
  contabtransluteo[ 85] = 0xC5AC -- UX breve
  contabtransluteo[117] = 0xC5AD -- ux breve

  -- constant strings (error circumfixes)

  local constrelabg = '<span class="error"><b>'             -- lagom whining begin
  local constrelaen = '</b></span>'                         -- lagom whining end
  local constrlaxhu = '&nbsp;&#42;&#42;&nbsp;'              -- lagom -> huge circumfix " ** "

  -- uncommentable EO vs ID (caller name for error messages)

  local constrkoll = 'sxablono "lili"'  -- EO augmented name of the caller (hardcoded, we do NOT peek it)
  -- local constrkoll = 'templat "lili"'   -- ID augmented name of the caller (hardcoded, we do NOT peek it)

  -- uncommentable EO vs ID constant table (error messages)

  -- note that #E00 and #E01 are NOT supposed to be included here

  local contaberaroj = {}
  contaberaroj[02] = 'Malica eraro en subprogramaro uzata far \\@'             -- EO #E02
  -- contaberaroj[02] = 'Kesalahan jahat dalam subprogram digunakan oleh \\@'     -- ID #E02
  contaberaroj[03] = 'Nombrigita eraro en subprogramaro uzata far \\@'         -- EO #E03
  -- contaberaroj[03] = 'Kesalahan ternomor dalam subprogram digunakan oleh \\@'  -- ID #E03
  contaberaroj[06] = 'Erara uzo de \\@, legu gxian dokumentajxon'              -- EO #E06
  -- contaberaroj[06] = 'Penggunaan salah \\@, bacalah dokumentasinya'            -- ID #E06
  contaberaroj[08] = 'Nevalida baza tipo "tip=" en \\@'                     -- EO #E08
  -- contaberaroj[08] = 'Tipe dasar salah "tip=" di \\@'                       -- ID #E08
  contaberaroj[09] = 'Nevalida signocxeno "hin=" "prf=" "err=" en \\@'      -- EO #E09
  -- contaberaroj[09] = 'String salah "hin=" "prf=" "err=" di \\@'             -- ID #E09
  contaberaroj[10] = 'Erara uzo de \\@ pro parametroj'                      -- EO #E10
  -- contaberaroj[10] = 'Penggunaan salah \\@ oleh karena parameter'           -- ID #E10

  -- uncommentable EO vs ID constant strings (misc)

  local constrevid = "evidente nevalida lingvokodo"                -- EO placeholder
  -- local constrevid = "kode bahasa jelas-jelas salah"               -- ID placeholder
  local constrneli = "nekonata lingvokodo"                         -- EO placeholder
  -- local constrneli = "kode bahasa tidak dikenal"                   -- ID placeholder

  -- constant table (3 integers for preliminary parameter check)

  local contabparam = {}
  contabparam[0] = 1   -- minimal number of anon parameters
  contabparam[1] = 1   -- maximal number of anon parameters
  contabparam[2] = 160 -- maximal length of single para (min is hardcoded as ONE)

  -- constants to control behaviour from source AKA semi-hardcoded parameters

  local conbookodlng  = false  -- "true" to allow long codes like "zh-min-nan"
  local conboomiddig  = false  -- "true" to allow middle digit "s7a"

------------------------------------------------------------------------

---- SPECIAL STUFF OUTSIDE MAIN [B] ----

------------------------------------------------------------------------

---- SPECIAL VAR:S ----

local qldingvoj = {}     -- type "table" and nested
local qbooguard = false  -- only for the guard test, pass to other var ASAP

---- GUARD AGAINST INTERNAL ERROR AND IMPORT ONE VIA LOADDATA ----

qbooguard = (type(constrpriv)~='string') or (type(constringvoj)~='string') or (type(constrkatp)~='string') or (type(constraldp)~='string') or (type(constrkoll)~='string')
if (not qbooguard) then
  qldingvoj = mw.loadData(constringvoj) -- can crash here
  qbooguard = (type(qldingvoj)~='table') -- seems to be always false
end--if

------------------------------------------------------------------------

---- MATH FUNCTIONS [E] ----

------------------------------------------------------------------------

local function mathisintrange (numinpuut, numzjmin, numzjmax)
  local numclean = 0
  local booisclean = false
  numclean = math.floor (numinpuut) -- no transcendental
  numclean = math.max (numclean,numzjmin) -- not below minimum
  numclean = math.min (numclean,numzjmax) -- no trillions
  booisclean = (numclean==numinpuut)
  return booisclean
end--function mathisintrange

local function mathdiv (xdividens, xdivisero)
  local resultdiv = 0 -- DIV operator lacks in LUA :-(
  resultdiv = math.floor (xdividens / xdivisero)
  return resultdiv
end--function mathdiv

local function mathmod (xdividendo, xdivisoro)
  local resultmod = 0 -- MOD operator is "%" and bitwise AND operator lack too
  resultmod = xdividendo % xdivisoro
  return resultmod
end--function mathmod

------------------------------------------------------------------------

-- Local function MATHBITWRIT

-- Write bit selected by ZERO-based index assigning it to "1" or "0".

-- Depends on functions :
-- [E] mathdiv mathmod

local function mathbitwrit (numinkoming, numbityndex, boowrite)
  local numpatched = 0
  local numcountup = 0
  local numweight = 1 -- single bit value 1 -> 2 -> 4 -> 8 ...
  local boosinglebit = false
  while true do
    if ((numinkoming==0) and (numcountup>numbityndex)) then
      break -- we have run out of bits on BOTH possible sources
    end--if
    if (numcountup==numbityndex) then
      boosinglebit = boowrite -- overwrite bit
    else
      boosinglebit = (mathmod(numinkoming,2)==1) -- pick bit
    end--if
    numinkoming = mathdiv(numinkoming,2) -- shift right
    if (boosinglebit) then
      numpatched = numpatched + numweight -- add one bit rtl only if true
    end--if
    numcountup = numcountup + 1 -- count up here until we run out of bits
    numweight = numweight * 2
  end--while
  return numpatched
end--function mathbitwrit

------------------------------------------------------------------------

---- NUMBER CONVERSION FUNCTIONS [N] ----

------------------------------------------------------------------------

-- Local function LFNUMTO2DIGIT

-- Convert integer 0...99 to decimal ASCII string always 2 digits "00"..."99".

-- Depends on functions :
-- [E] mathisintrange mathdiv mathmod

local function lfnumto2digit (numzerotoninetynine)
  local strtwodig = '??' -- always 2 digits
  if (mathisintrange(numzerotoninetynine,0,99)) then
    strtwodig = tostring(mathdiv(numzerotoninetynine,10)) .. tostring(mathmod(numzerotoninetynine,10))
  end--if
  return strtwodig
end--function lfnumto2digit

------------------------------------------------------------------------

---- LOW LEVEL STRING FUNCTIONS [G] ----

------------------------------------------------------------------------

-- test whether char is an ASCII digit "0"..."9", return boolean

local function lfgtestnum (numkaad)
  local boodigit = false
  boodigit = ((numkaad>=48) and (numkaad<=57))
  return boodigit
end--function lfgtestnum

------------------------------------------------------------------------

-- test whether char is an ASCII uppercase letter, return boolean

local function lfgtestuc (numkode)
  local booupperc = false
  booupperc = ((numkode>=65) and (numkode<=90))
  return booupperc
end--function lfgtestuc

------------------------------------------------------------------------

-- test whether char is an ASCII lowercase letter, return boolean

local function lfgtestlc (numcode)
  local boolowerc = false
  boolowerc = ((numcode>=97) and (numcode<=122))
  return boolowerc
end--function lfgtestlc

------------------------------------------------------------------------

---- UTF8 FUNCTIONS [U] ----

------------------------------------------------------------------------

-- Local function LFULNUTF8CHAR

-- Evaluate length of a single UTF8 char in octet:s.

-- Input  : * numbgoctet  -- beginning octet of a UTF8 char

-- Output : * numlen1234x -- unit octet, number 1...4, or ZERO if invalid

-- Does NOT thoroughly check the validity, looks at ONE octet only.

local function lfulnutf8char (numbgoctet)
  local numlen1234x = 0
    if (numbgoctet<128) then
      numlen1234x = 1 -- $00...$7F -- ANSI/ASCII
    end--if
    if ((numbgoctet>=194) and (numbgoctet<=223)) then
      numlen1234x = 2 -- $C2 to $DF
    end--if
    if ((numbgoctet>=224) and (numbgoctet<=239)) then
      numlen1234x = 3 -- $E0 to $EF
    end--if
    if ((numbgoctet>=240) and (numbgoctet<=244)) then
      numlen1234x = 4 -- $F0 to $F4
    end--if
  return numlen1234x
end--function lfulnutf8char

------------------------------------------------------------------------

-- Local function LFCASEREST

-- Adjust case of a single letter (restricted), only ASCII
-- plus a very limited set of 2-octet UTF8 letters. (this is REST)

-- Input  : * strucinrsut : single unicode letter (1 or 2 octet:s)
--          * booupcas    : for desired uppercase "true" and for
--                          lowercase "false"
--          * numselset   : 0 ASCII -- 2 eo -- 5 sv (value 255 NOT here)

-- Output : * strucinrsut (same var) : special value "ZZ" on failure

-- Depends on functions : (this is REST)
-- [U] lfulnutf8char
-- [G] lfgtestuc lfgtestlc
-- [E] mathdiv mathmod mathbitwrit

-- Unknown non-ASCII input strictly returns "ZZ"

-- Defined sets:
-- 2: 2 x 6 uppercase and lowercase -eo- (CX GX HX JX SX UX cx gx hx jx sx ux)
--    upper CX $0108 GX $011C HX $0124 JX $0134 SX $015C UX $016C lower +1
-- 5: 2 x 4 uppercase and lowercase -sv- (AA AE OE EE aa ae oe ee)
--    upper AE $00C4 AA $00C5 EE $00C9 OE $00D6 lower +$20

local function lfcaserest (strucinrsut, booupcas, numselset)

  local numlaengdn = 0 -- length from "string.len"
  local numchaerr = 0 -- UINT8 beginning char
  local numchaess = 0 -- UINT8 later char (BIG ENDIAN, lower value here up)
  local numchareel = 0 -- UINT8 code relative to beginning of block $00...$FF
  local numdeta = 0 -- SINT8 +32 or -32 or +1 or -1 or ZERO
  local numtheemp = 0

  local boowantlowr = false
  local booiisuppr = false
  local booiislowr = false
  local boovalid = false -- preASSume guilt

  booupcas = not (not booupcas)
  boowantlowr = (not booupcas)

  while true do -- upper fake loop (this is REST)

    numlaengdn = string.len (strucinrsut)
    if ((numlaengdn<1) or (numlaengdn>2)) then -- only 1 or 2 accepted
      break -- bad string length
    end--if
    numchaerr = string.byte (strucinrsut,1,1)
    if ((lfulnutf8char(numchaerr))~=numlaengdn) then
      break -- mismatch with length
    end--if

    if (numlaengdn==1) then
      booiisuppr = lfgtestuc(numchaerr)
      booiislowr = lfgtestlc(numchaerr)
      if (booiisuppr and boowantlowr) then
        numdeta = 32 -- ASCII UPPER->lower
      end--if
      if (booiislowr and booupcas) then
        numdeta = -32 -- ASCII lower->UPPER
      end--if
      boovalid = true
      break -- success with ASCII, almost done
    end--if

    numchaess = string.byte (strucinrsut,2,2) -- only $80 to $BF
    numchareel = (mathmod(numchaerr,4)*64) + (numchaess-128) -- 4 times 64

    if ((numselset==2) and ((numchaerr==196) or (numchaerr==197))) then -- eo
      numtheemp = mathbitwrit (numchareel,0,false) -- bad way to do AND $FE
      if ((numtheemp==8) or (numtheemp==28) or (numtheemp==36) or (numtheemp==52) or (numtheemp==92) or (numtheemp==108)) then
        booiisuppr = (numtheemp==numchareel) -- UC below and even
        booiislowr = not booiisuppr
        if (booiisuppr and boowantlowr) then
          numdeta = 1 -- UPPER->lower
        end--if
        if (booiislowr and booupcas) then
          numdeta = -1 -- lower->UPPER
        end--if
        boovalid = true
        break -- success with -eo-, almost done
      end--if
    end--if ((numselset==2) and ...

    if ((numselset==5) and (numchaerr==195)) then -- sv
      numtheemp = mathbitwrit (numchareel,5,false) -- bad way to do AND $DF
      if ((numtheemp==196) or (numtheemp==197) or (numtheemp==201) or (numtheemp==214)) then
        booiisuppr = (numtheemp==numchareel) -- UC below and bit is ZERO
        booiislowr = not booiisuppr
        if (booiisuppr and boowantlowr) then
          numdeta = 32 -- UPPER->lower
        end--if
        if (booiislowr and booupcas) then
          numdeta = -32 -- lower->UPPER
        end--if
        boovalid = true
        break -- success with -sv-, almost done
      end--if
    end--if ((numselset==5) and ...

    break -- finally to join mark -- unknown non-ASCII char is a fact :-(
  end--while -- upper fake loop -- join mark (this is REST)

  while true do -- lower fake loop (this is REST)

    if (not boovalid) then
      strucinrsut = "ZZ" -- unknown non-ASCII char
      break -- helvete
    end--if

    if (numdeta==0) then
      break -- nothing to do
    end--if

    if (numlaengdn==1) then
      strucinrsut = string.char (numchaerr + numdeta) -- no risk of carry here
      break -- done
    end--if

    strucinrsut = string.char (numchaerr) .. string.char (numchaess + numdeta)

    break -- finally to join mark
  end--while -- lower fake loop -- join mark (this is REST)

  return strucinrsut -- same var for input and output

end--function lfcaserest

------------------------------------------------------------------------

-- Local function LFUCASESTR

-- Adjust case of beginning letter or of all letters in a word or group
-- of words to upper or lower, with limited and adjustable unicode support.

-- Input  : * strenigo  : word or group of words (may be empty)
--          * boouprcas : "true" for uppercase and "false" for lowercase
--          * boodooall : "true" to adjust all letters, "false" only beginning
--          * numslsaet : 0 ASCII -- 2 eo -- 5 sv -- NOPE 255 generic

-- Depends on functions : (restricted LFCASEREST)
-- [U] lfulnutf8char lfcaserest
-- [G] lfgtestuc lfgtestlc
-- [E] mathdiv mathmod mathbitwrit

local function lfucasestr (strenigo, boouprcas, boodooall, numslsaet)

  local numlein = 0
  local numposi = 1 -- octet position ONE-based
  local numcut = 0 -- length of an UTF8 char
  local bootryadj = false -- try to adjust single char
  local strte7mp = ''
  local strelygo = ''

  boouprcas = not (not boouprcas)
  boodooall = not (not boodooall)
  numlein = string.len (strenigo)

  while true do
    if (numposi>numlein) then
      break -- done
    end--if
    bootryadj = (boodooall or (numposi==1))
    numcut = lfulnutf8char(string.byte(strenigo,numposi,numposi))
    if ((numcut==0) or ((numposi+numcut-1)>numlein)) then
      numcut = 1 -- skip ie copy one faulty octet
      bootryadj = false
    end--if
    strte7mp = string.sub (strenigo,numposi,(numposi+numcut-1)) -- 1...4 oct
    if (bootryadj) then
      -- if (numslsaet==255) then
        -- strte7mp = lfcasegene(strte7mp,boouprcas) -- (generous LFCASEGENE)
      -- else
        strte7mp = lfcaserest(strte7mp,boouprcas,numslsaet) -- (restricted LFCASEREST)
      -- end--if
    end--if
    strelygo = strelygo .. strte7mp -- this can be slow
    numposi = numposi + numcut -- done 1...4 octet:s
  end--while

  return strelygo

end--function lfucasestr

------------------------------------------------------------------------

---- HIGH LEVEL STRING FUNCTIONS [I] ----

------------------------------------------------------------------------

-- Local function LFIBREWCATHINT

-- Brew sorting hint/key for wiki category by lowering all letters and
-- removing junk chars other than letters and numbers. All ASCII and
-- selected non-ASCII letters do count as such. Particularly ban spaces
-- and dashes. Controllably UTF8-aware.

-- Input  : * strhinthink
--          * numsignaro -- 0 ASCII -- 2 eo -- 5 sv -- NOPE 255 generic
--          * bookeepuk -- keep unknown non-ASCII (by default dropped)

-- Output : * strhasiil -- risk of empty

-- Depends on functions : (restricted LFCASEREST)
-- [U] lfulnutf8char lfcaserest
-- [G] lfgtestnum lfgtestuc lfgtestlc
-- [E] mathdiv mathmod mathbitwrit

-- Simplified strategy:
-- * numbers unchanged
-- * ASCII lowercase unchanged
-- * ASCII uppercase lowered
-- * non-ASCII sent to "lfcase" with attempt to lower, if unknown then
--   by default dropped, alternatively unchanged
-- * everything else dropped
-- * broken stream aborts and gives empty result

local function lfibrewcathint (strhinthink, numsignaro, bookeepuk)

  local strhasiil = ''
  local stronechhar = ''
  local stronechaar = ''
  local numstrleon = 0
  local numeindx = 1 -- ONE-based
  local numczaar = 0
  local numczanx = 0 -- pre-picked next char
  local numettfyra = 0

  numstrleon = string.len (strhinthink)

  while true do -- outer genuine loop over source string

    if (numeindx>numstrleon) then
      break -- empty input is useless but cannot cause major harm
    end--if

    numczaar = string.byte (strhinthink,numeindx,numeindx)
    numeindx = numeindx + 1 -- do INC here
    numczanx = 0
    if (numeindx<=numstrleon) then -- pick but do NOT INC
      numczanx = string.byte (strhinthink,numeindx,numeindx)
    end--if

    while true do -- inner fake loop
      numettfyra = lfulnutf8char (numczaar) -- 1...4 or ZERO on error
      if (numettfyra==1) then
        if (lfgtestnum(numczaar) or lfgtestlc(numczaar)) then
          stronechaar = string.char (numczaar)
          break -- numbers and ASCII lowercase pass unchanged
        end--if
        if (lfgtestuc(numczaar)) then
          stronechaar = string.char (numczaar+32) -- lower ASCII letter
          break -- lower it
        end--if
      end--if
      if (numettfyra==2) then
        stronechaar = string.char(numczaar,numczanx)
        -- if (numsignaro==255) then
          -- stronechhar = lfcasegene (stronechaar,false)
        -- else
          stronechhar = lfcaserest (stronechaar,false,numsignaro)
        -- end--if
        if (stronechhar=='ZZ') then -- unknown non-ASCII
          if (not bookeepuk) then
            stronechaar = '' -- discard it, else let it pass
          end--if
        else
          stronechaar = stronechhar -- converted
        end--if
        break -- done here
      end--if
      stronechaar = '' -- anything else -> discard it
      break -- finally to join mark
    end--while -- inner fake loop -- join mark

    if (numettfyra==0) then
      strhasiil = ''
      break -- broken stream -> bugger all -- exit outer loop
    end--if

    strhasiil = strhasiil .. stronechaar -- ASCII char or UTF8 char or ""
    numeindx = numeindx + numettfyra - 1 -- do ADD here

  end--while -- outer genuine loop over source string

  return strhasiil

end--function lfibrewcathint

------------------------------------------------------------------------

-- Local function LFIVALIDATELNKOADV

-- Advanced test whether a string (intended to be a language code) is valid
-- containing only 2 or 3 lowercase letters, or 2...10 char:s and with some
-- dashes, or maybe a digit in middle position or maybe instead equals to "-"
-- or "??" and maybe additionally is not included on the ban list.

-- Input  : * strqooq -- string (empty is useless and returns
--                       "true" ie "bad" but cannot cause any major harm)
--          * booyesdsh -- "true" to allow special code dash "-"
--          * booyesqst -- "true" to allow special code doublequest "??"
--          * booloonkg -- "true" to allow long codes such as "zh-min-nan"
--          * boodigit -- "true" to allow digit in middle position
--          * boonoban -- (inverted) "true" to skip test against ban table

-- Output : * booisvaladv -- true if string is valid

-- Depends on functions :
-- [G] lfgtestnum lfgtestlc

-- Depends on constants :
-- * table "contabisbanned"

-- Incoming empty string is safe but type "nil" is NOT.

-- Digit is tolerable only ("and" applies):
-- * if boodigit is "true"
-- * if length is 3 char:s
-- * in middle position

-- Dashes are tolerable (except in special code "-") only ("and" applies):
-- * if length is at least 4 char:s (if this is permitted at all)
-- * in inner positions
-- * NOT adjacent
-- * maximally TWO totally
-- There may be maximally 3 adjacent letters, this makes at least ONE dash
-- obligatory for length 4...7, and TWO dashes for length 8...10.

local function lfivalidatelnkoadv (strqooq, booyesdsh, booyesqst, booloonkg, boodigit, boonoban)

  local varomongkosong = 0 -- for check against the ban list
  local numchiiar = 0
  local numukurran = 0
  local numindeex = 0 -- ZERO-based -- two loops
  local numadjlet = 0 -- number of adjacent letters (max 3)
  local numadjdsh = 0 -- number of adjacent dashes (max 1)
  local numtotdsh = 0 -- total number of dashes (max 2)
  local booislclc = false
  local booisdigi = false
  local booisdash = false
  local booisvaladv = true -- preASSume innocence -- later final verdict here

  while true do -- fake (outer) loop

    if (strqooq=="-") then
      booisvaladv = booyesdsh
      break -- to join mark -- good or bad
    end--if
    if (strqooq=="??") then
      booisvaladv = booyesqst
      break -- to join mark -- good or bad
    end--if
    numukurran = string.len (strqooq)
    if ((numukurran<2) or (numukurran>10)) then
      booisvaladv = false
      break -- to join mark -- evil
    end--if
    if (not booloonkg and (numukurran>3)) then
      booisvaladv = false
      break -- to join mark -- evil
    end--if

    numindeex = 0
    while true do -- inner genuine loop over char:s
      if (numindeex>=numukurran) then
        break -- done -- good
      end--if
      numchiiar = string.byte (strqooq,(numindeex+1),(numindeex+1))
      booisdash = (numchiiar==45)
      booisdigi = lfgtestnum(numchiiar)
      booislclc = lfgtestlc(numchiiar)
      if (not (booislclc or booisdigi or booisdash)) then
        booisvaladv = false
        break -- to join mark -- inherently bad char
      end--if
      if (booislclc) then
        numadjlet = numadjlet + 1
      else
        numadjlet = 0
      end--if
      if (booisdigi and ((numukurran~=3) or (numindeex~=1) or (not boodigit))) then
        booisvaladv = false
        break -- to join mark -- illegal digit
      end--if
      if (booisdash) then
        if ((numukurran<4) or (numindeex==0) or ((numindeex+1)==numukurran)) then
          booisvaladv = false
          break -- to join mark -- illegal dash
        end--if
        numadjdsh = numadjdsh + 1
        numtotdsh = numtotdsh + 1 -- total
      else
        numadjdsh = 0 -- do NOT zeroize the total !!!
      end--if
      if ((numadjlet>3) or (numadjdsh>1) or (numtotdsh>2)) then
        booisvaladv = false
        break -- to join mark -- evil
      end--if
      numindeex = numindeex + 1 -- ZERO-based
    end--while -- inner genuine loop over char:s

    if (not boonoban) then -- if "yesban" then
      numindeex = 0
      while true do -- lower inner genuine loop
        varomongkosong = contabisbanned[numindeex+1] -- number of elem unknown
        if (type(varomongkosong)~="string") then
          break -- abort inner loop (then outer fake loop) due to end of table
        end--if
        numukurran = string.len (varomongkosong)
        if ((numukurran<2) or (numukurran>3)) then
          break -- abort inner loop (then outer fake loop) due to faulty table
        end--if
        if (strqooq==varomongkosong) then
          booisvaladv = false
          break -- abort inner loop (then outer fake loop) due to violation
        end--if
        numindeex = numindeex + 1 -- ZERO-based
      end--while -- lower inner genuine loop
    end--if (not boonoban) then

    break -- finally to join mark
  end--while -- fake loop -- join mark

  return booisvaladv

end--function lfivalidatelnkoadv

------------------------------------------------------------------------

-- Local function LFIFILLNAME

-- Replace placeholder "\@" "\\@" by augmented name of the caller.

-- To be called ONLY from "lfhfillsurrstrtab".

-- The name of the caller is submitted to us as a parameter thus we
-- do NOT access any constants and do NOT have to peek it either.

local function lfifillname (strmessage, strcaller)

  local strhasill = ''
  local numstrloen = 0
  local numindfx = 1 -- ONE-based
  local numcjar = 0
  local numcjnext = 0

  numstrloen = string.len (strmessage)

  while true do
    if (numindfx>numstrloen) then
      break -- empty input is useless but cannot cause major harm
    end--if
    numcjar = string.byte (strmessage,numindfx,numindfx)
    numindfx = numindfx + 1
    numcjnext = 0 -- preASSume no char
    if (numindfx<=numstrloen) then
      numcjnext = string.byte (strmessage,numindfx,numindfx)
    end--if
    if ((numcjar==92) and (numcjnext==64)) then
      strhasill = strhasill .. strcaller -- invalid input is caller's risk
      numindfx = numindfx + 1 -- skip 2 octet:s of the placeholder
    else
      strhasill = strhasill .. string.char (numcjar)
    end--if
  end--while

  return strhasill

end--function lfifillname

------------------------------------------------------------------------

-- Local function LFIKODEOSG

-- Transcode eo X-surrogates to cxapeloj in a single string (eo only).

-- Input  : * streosurr -- ANSI string (empty is useless but cannot
--                                      cause major harm)

-- Output : * strutf8eo -- UTF8 string

-- Depends on functions :
-- [E] mathdiv mathmod

-- Depends on constants :
-- * table "contabtransluteo" inherently holy

-- To be called ONLY from "lfhfillsurrstrtab".

-- * the "x" in a surr pair is case insensitive,
--   for example both "kacxo" and "kacXo" give same result
-- * avoid "\", thus for example "ka\cxo" would get converted but the "\" kept
-- * double "x" (both case insensitive) prevents conversion and becomes
--   reduced to single "x", for example "kacxxo" becomes "kacxo"

local function lfikodeosg (streosurr)

  local vareopeek = 0
  local strutf8eo = ''
  local numeoinplen = 0
  local numinpinx = 0 -- ZERO-based source index
  local numknar0k = 0 -- current char
  local numknaf1x = 0 -- next char (ZERO is NOT valid)
  local numknaf2x = 0 -- post next char (ZERO is NOT valid)
  local boonext1x = false
  local boonext2x = false
  local boosudahdone = false

  numeoinplen = string.len(streosurr)

  while true do

    if (numinpinx>=numeoinplen) then
      break
    end--if

    numknar0k = string.byte(streosurr,(numinpinx+1),(numinpinx+1))
    numknaf1x = 0 -- preASSume no char
    numknaf2x = 0 -- preASSume no char
    if ((numinpinx+1)<numeoinplen) then
      numknaf1x = string.byte(streosurr,(numinpinx+2),(numinpinx+2))
    end--if
    if ((numinpinx+2)<numeoinplen) then
      numknaf2x = string.byte(streosurr,(numinpinx+3),(numinpinx+3))
    end--if

    boonext1x = ((numknaf1x==88) or (numknaf1x==120)) -- case insensitive
    boonext2x = ((numknaf2x==88) or (numknaf2x==120)) -- case insensitive
    boosudahdone = false
    if (boonext1x and boonext2x) then -- got "xx"
      strutf8eo = strutf8eo .. string.char(numknar0k,numknaf1x) -- keep one "x" only
      numinpinx = numinpinx + 3 -- eaten 3 written 2
      boosudahdone = true
    end--if
    if (boonext1x and (not boonext2x)) then -- got yes-"x" and no-"x"
      vareopeek = contabtransluteo[numknar0k] -- UINT16 or type "nil"
      if (type(vareopeek)=='number') then
        strutf8eo = strutf8eo .. string.char(mathdiv(vareopeek,256),mathmod(vareopeek,256)) -- add UTF8 char
        numinpinx = numinpinx + 2 -- eaten 2 written 2
        boosudahdone = true
      end--if
    end--if
    if (not boosudahdone) then
      strutf8eo = strutf8eo .. string.char(numknar0k) -- copy char
      numinpinx = numinpinx + 1 -- eaten 1 written 1
    end--if

  end--while

  return strutf8eo

end--function lfikodeosg

------------------------------------------------------------------------

-- Local function LFIVARILINGVONOMO

-- Input  : * strlang29name : such as "Ido" or "dana" or "samea suda"
--          * numtip29mon   : 0 native -- 1 la (AJ SB) -- 2 aj -- 3 sf (root)
--                            4 av (AV real or surrogate) -- 5 pl (AJ and PL)
--          * boomaju

-- Depends on functions :
-- [U] lfulnutf8char lfcaserest lfucasestr
-- [G] lfgtestuc lfgtestlc
-- [E] mathdiv mathmod mathbitwrit

-- incoming multiword SB such as "Malnova Volapuko" is bad, we
-- can't process such

-- note that for "numtip29mon" 1 ie "la" we will add the article to
-- native AJ only, never to native SB (but type 4 ie "av" can force AJ
-- and subsequently add "la")

-- note that we MUST NOT change the word class to AJ
-- for "numtip29mon" 4 ie "av" if multiword

-- for "numtip29mon" 5 ie "pl" we change the word class to AJ too

local function lfivarilingvonomo (strlang29name, numtip29mon, boomaju)

  local strpluralizator = ''
  local num29lon     = 0
  local num29plindex = 0
  local nummychar    = 0
  local nummyches    = 0
  local booisnoun    = false
  local boomulwords  = false
  local booaddprepen = false
  local booaddartla  = false

  if ((numtip29mon>=1) and (numtip29mon<=5)) then

    num29lon = string.len (strlang29name)
    nummychar = string.byte (strlang29name,num29lon,num29lon) -- last

    booisnoun = (nummychar==111) -- "o"
    boomulwords = (string.find (strlang29name, ' ', 1, true)~=nil) -- plain tx
    booaddprepen = (numtip29mon==4) and boomulwords -- surrogate AV with "en"
    booaddartla = (booisnoun==false) and ((numtip29mon==1) or booaddprepen)

    if ((numtip29mon>=2) and (booaddprepen==false)) then
      strlang29name = string.sub (strlang29name,1,-2) -- cut off last letter
      strlang29name = lfucasestr (strlang29name,false,false,2) -- lower it
    end--if
    if (booaddartla) then
      strlang29name = 'la ' .. strlang29name -- we will NOT pluralize this
    end--if
    if ((numtip29mon==2) or (numtip29mon==5)) then
      strlang29name = strlang29name .. "a" -- AJ (pluralize later if needed)
    end--if

    if (numtip29mon==4) then
      if (boomulwords) then
        strlang29name = "en " .. strlang29name -- surrog AV from PP "en" + ...
      else
        strlang29name = strlang29name .. "e" -- AV
      end--if
    end--if

    if (numtip29mon==5) then
      if (boomulwords) then
        strpluralizator = strlang29name
        strlang29name = '' -- we will rebuild it
        num29lon = string.len (strpluralizator)
        num29plindex = 0 -- ZERO-based
        while true do -- pluralize all words except the last one
          if (num29plindex==num29lon) then
            break
          end--if
          nummychar = string.byte (strpluralizator,(num29plindex+1),(num29plindex+1))
          num29plindex = num29plindex + 1 -- ZERO-based
          nummyches = 0
          if (num29plindex~=num29lon) then
            nummyches = string.byte (strpluralizator,(num29plindex+1),(num29plindex+1))
          end--if
          if ((nummychar==97) and (nummyches==32)) then
            strlang29name = strlang29name .. 'aj '
            num29plindex = num29plindex + 1 -- eaten 2 char:s, written 3
          else
            strlang29name = strlang29name .. string.char(nummychar) -- copy ch
          end--if
        end--while
      end--if (boomulwords) then
      strlang29name = strlang29name .. "j" -- pluralize last or only one AJ
    end--if (numtip29mon==5) then

  end--if ((numtip29mon>=1) and (numtip29mon<=5)) then

  if (boomaju) then
    strlang29name = lfucasestr (strlang29name,true,false,2) -- upper, one, eo
  end--if

  return strlang29name

end--function lfivarilingvonomo

------------------------------------------------------------------------

---- HIGH LEVEL FUNCTIONS [H] ----

------------------------------------------------------------------------

-- Local function LFHCONSTRUCTERAR

-- Input  : * numerar6code -- 1 ... 99 or 2 ... 99 invalid type ignored
--          * boopeek6it

-- Depends on functions :
-- [N] lfnumto2digit
-- [E] mathisintrange mathdiv mathmod

-- Depends on constants :
-- * maybe table contaberaroj TWO-based (holes permitted)

-- To be called ONLY from lfhbrewerror, lfhbrewerrsm,
-- lfhbrewerrsvr, lfhbrewerrinsi.

local function lfhconstructerar (numerar6code, boopeek6it)
  local vardes6krip = 0
  local numbottom6limit = 1
  local stryt6sux = '#E'
  if (type(numerar6code)~='number') then
    numerar6code = 0 -- invalid
  end--if
  if (boopeek6it) then
    numbottom6limit = 2 -- #E01 is a valid code for submodule only
  end--if
  if (mathisintrange(numerar6code,numbottom6limit,99)) then
    stryt6sux = stryt6sux .. lfnumto2digit(numerar6code)
    if (boopeek6it) then
      vardes6krip = contaberaroj[numerar6code] -- risk of type "nil"
      if (type(vardes6krip)=='string') then
        stryt6sux = stryt6sux .. ' ' .. vardes6krip
      else
        stryt6sux = stryt6sux .. ' ??' -- no text found
      end--if
    end--if (boopeek6it) then
  else
    stryt6sux = stryt6sux .. '??' -- no valid error code
  end--if
  return stryt6sux

end--function lfhconstructerar

------------------------------------------------------------------------

-- Local function LFHBREWERRSM

-- Input  : * numerar8code -- 2 ... 99
--          * strsubnama -- can be omitted if no submodule
--          * numsubkodo -- 1 ... 99 invalid type ignored

-- Depends on functions :
-- [H] lfhconstructerar
-- [N] lfnumto2digit
-- [E] mathisintrange mathdiv mathmod

-- Depends on constants :
-- * 3 strings constrelabg constrelaen constrlaxhu
-- * table contaberaroj TWO-based (holes permitted)

local function lfhbrewerrsm (numerar8code, strsubnama, numsubkodo)
  local stryt8sux = ''
  local strfromsubo = ''
  stryt8sux = constrlaxhu .. constrelabg .. lfhconstructerar (numerar8code,true) .. constrelaen .. constrlaxhu
  if (type(strsubnama)=='string') then
    strfromsubo = 'Submodule "' .. strsubnama .. '" reports ' .. lfhconstructerar (numsubkodo,false)
    stryt8sux = stryt8sux .. '<br>' .. constrlaxhu .. constrelabg .. strfromsubo .. constrelaen .. constrlaxhu
  end--if
  return stryt8sux
end--function lfhbrewerrsm

------------------------------------------------------------------------

-- Local function LFHFILLSURRSTRTAB

-- Process (fill in, transcode surr) either a single string, or all string
-- items in a table (even nested) using any type of keys/indexes (such as
-- a holy number sequence and non-numeric ones). Items with a non-string
-- value are kept as-is. For filling in own name, and converting eo and
-- NOPE sv surrogates (via 3 separate sub:s).

-- Input  : * varinkommen -- type "string" or "table"
--          * varfyllo -- string, or type "nil" if no filling-in desired
--          * strlingkod -- "eo" or NOPE "sv" to convert surrogates, anything
--                          else (preferably type "nil") to skip this

-- Depends on functions :
-- [I] lfifillname (only if filling-in desired)
-- [I] lfikodeosg (only if converting of eo X-surrogates desired)
-- [I] NOPE lfikodsvsg
-- [E] mathdiv mathmod (via "lfikodeosg" and NOPE "lfikodsvsg")

-- Depends on constants :
-- * table "contabtransluteo" inherently holy (via "lfikodeosg")
-- * NOPE table "contabtranslutsv"

local function lfhfillsurrstrtab (varinkommen, varfyllo, strlingkod)

  local varkey = 0 -- variable without type
  local varele = 0 -- variable without type
  local varutmatning = 0
  local boodone = false

  if (type(varinkommen)=='string') then
    if (type(varfyllo)=='string') then
      varinkommen = lfifillname (varinkommen,varfyllo) -- fill-in
    end--if
    if (strlingkod=='eo') then
      varinkommen = lfikodeosg (varinkommen) -- surr
    end--if
    -- if (strlingkod=='sv') then
      -- varinkommen = lfikodsvsg (varinkommen) -- surr
    -- end--if
    varutmatning = varinkommen -- copy, risk for no change
    boodone = true
  end--if

  if (type(varinkommen)=='table') then
    varutmatning = {} -- brew new table
    varkey = next (varinkommen) -- try to pick 0:th (in no order) key/index
    while true do
      if (varkey==nil) then
        break -- empty table or end reached
      end--if
      varele = varinkommen[varkey] -- pick element of unknown type
      if ((type(varele)=='string') or (type(varele)=='table')) then
        varele = lfhfillsurrstrtab (varele, varfyllo, strlingkod) -- RECURSION
      end--if
      varutmatning[varkey] = varele -- write at same place in dest table
      varkey = next (varinkommen, varkey) -- try to pick next key/index
    end--while
    boodone = true
  end--if

  if (not boodone) then
    varutmatning = varinkommen -- copy as-is whatever it is
  end--if

  return varutmatning

end--function lfhfillsurrstrtab

------------------------------------------------------------------------

---- VARIABLES [R] ----

------------------------------------------------------------------------

function exporttable.ek (arxframent)

  -- general unknown type

  local vartmp = 0     -- variable without type

  -- special type "args" AKA "arx"

  local arxsomons = 0  -- metaized "args" from our own or caller's "frame"

  -- general "tab"

  local tablg76yleft = {}

  -- general "str"

  local strnambah  = ''  -- language name (without prefix "Bahasa")
  local strnambauc = ''  -- language name uppercased begin ("Angla")
  local strnambaty = ''  -- lng name processed according to "mon=" and "maj=1"
  local strtamp    = ''
  local strtymp    = ''
  local strvisgud  = ''  -- visible output or cat insertion on success
  local strviserr  = ''  -- visible error message on error (no tracking cat)
  local strret     = ''  -- result string

  -- parameters "str"

  local strkodbah  = ''  -- language code (2 or 3 lowercase) from arxsomons[1]
  local strhinhin  = ''  -- name of category KE (lang code will brew the hint)
  local strprfprf  = ''  -- prefix before language name
  local strerarpl  = ''  -- custom but common placeholder

  -- general "num"

  local numerr     = 0 -- 1 inter 2 mali 3 nombri 8 tip 9 cxeno3 10 misc
  local numpindex  = 0 -- number of anon params
  local numlong    = 0 -- length of parameter mm
  local numtamp    = 0
  local numlangsta = 0 -- 2 known -- 1 unknown -- 0 obviously invalid
  local num2statcode = 0

  -- parameters "num"

  local numbasetipe = 0 -- bast : 0 raw -- 1 LA -- 2 LK -- 3 KE -- 4 empty
  local nummontip   = 0 -- lngt : 0 nt -- 1 la -- 2 aj -- 3 sf -- 4 av -- 5 pl

  -- parameters "boo"

  local boonem  = false -- avoid wall in visible link of type LA LK
  local boomaj  = false -- force uppercase
  local boonoc  = false -- infamous "nocat" (cannot cause an error)
  local booper  = false -- keep link or cat insertion on error
  local boohavehin = false
  local boohaveprf = false
  local boohaveerr = false

------------------------------------------------------------------------

---- MAIN [Z] ----

------------------------------------------------------------------------

  ---- GUARD AGAINST INTERNAL ERROR AGAIN ----

  -- later reporting of #E01 must NOT depend on uncommentable stuff

  if (qbooguard) then
    numerr = 1 -- #E01 internal
  end--if

  ---- PROCESS MESSAGES, FILL IN ALWAYS, SURR ONLY IF NEEDED ----

  -- needed for all errors except #E01

  -- placeholder "\@" "\\@" is replaced by augmented name of the caller
  -- from "constrkoll" in any case, for example 'sxablono "test"' or
  -- 'templat "test"'

  -- only for some languages the surr-transcoding is subsequently performed

  if (numerr==0) then
    contaberaroj = lfhfillsurrstrtab (contaberaroj, constrkoll, constrpriv)
  end--if

  ---- PICK ONE SUBTABLE ----

  -- on error we assign "numerr" and "num2statcode" both used far below

  while true do -- fake loop

    if (numerr~=0) then -- #E01 possible
      break -- to join mark
    end--if

    num2statcode = qldingvoj[2] -- from "loaddata-tbllingvoj"
    if (type(num2statcode)~='number') then -- important check
      numerr = 2 -- #E02 malica
      break -- to join mark
    end--if
    if (num2statcode~=0) then
      if (mathisintrange(num2statcode,2,79)) then
        numerr = 3 -- #E03 nombrigita
      else
        numerr = 2 -- #E02 malica
      end--if
      break -- to join mark
    end--if
    tablg76yleft = qldingvoj['T76']
    if (type(tablg76yleft)~='table') then -- important check
      numerr = 2 -- #E02 malica
      break -- to join mark
    end--if

    break -- finally to join mark
  end--while -- fake loop -- join mark

  ---- GET THE ARX (ONE OF TWO) ----

  -- must be seized independently on "numerr" even if we already suck

  -- give a f**k in possible params other than "caller=true"

  arxsomons = arxframent.args -- "args" from our own "frame"
  if (type(arxsomons)~='table') then
    arxsomons = {} -- guard against indexing error from our own
    numerr = 1 -- #E01 internal
  end--if
  if (arxsomons['caller']=='true') then
    arxsomons = arxframent:getParent().args -- "args" from caller's "frame"
  end--if
  if (type(arxsomons)~='table') then
    arxsomons = {} -- guard against indexing error again
    numerr = 1 -- #E01 internal
  end--if

  ---- WHINE IF YOU MUST #E01 ----

  -- reporting of this error #E01 must NOT depend on
  -- uncommentable stuff such as "constrkoll" and "contaberaroj"

  -- do NOT use sub "lfhbrewerror", report our name (NOT of template), in EN

  if (numerr==1) then
    strtymp = '#E01 Internal error in module "mlili".'
    strviserr = constrlaxhu .. constrelabg .. strtymp .. constrelaen .. constrlaxhu
  end--if

  ---- PRELIMINARILY ANALYZE ANONYMOUS PARAMETERS ----

  -- this will catch holes, empty parameters, too long parameters,
  -- and wrong number of parameters

  -- below on exit var "numpindex" will contain number of
  -- prevalidated anonymous params

  -- this depends on 3 constants:
  -- * contabparam[0] minimal number
  -- * contabparam[1] maximal number
  -- * contabparam[2] maximal length (default 160)

  if (numerr==0) then
    numpindex = 0 -- ZERO-based
    numtamp = contabparam[1] -- maximal number of params
    while true do
      vartmp = arxsomons [numpindex+1] -- can be "nil"
      if ((type(vartmp)~="string") or (numpindex>numtamp)) then
        break -- good or bad
      end--if
      numlong = string.len (vartmp)
      if ((numlong==0) or (numlong>contabparam[2])) then
        numerr = 6 -- #E06 param/RTFD
        break -- only bad here
      end--if
      numpindex = numpindex + 1 -- on exit has number of valid parameters
    end--while
    if ((numpindex<contabparam[0]) or (numpindex>numtamp)) then
      numerr = 6 -- #E06 param/RTFD
    end--if
  end--if

  ---- PROCESS ONE OBLIGATORY ANONYMOUS PARAM INTO ONE STRING AND ONE NUM ----

  -- now var "numpindex" sudah contains number of prevalidated params
  -- and is always 1 and is useless

  -- here we prevalidate and assign "strkodbah" and "numlangsta"

  -- this depends directly on 2 boolean constant:s and indirectly
  -- on constant table "contabisbanned" via "lfhvalidatelnkoadv"

  if (numerr==0) then
    numlangsta = 2 -- this is just weak hope ...
    strkodbah = arxsomons[1] -- language code (obligatory, "??" permitted)
    if (not lfivalidatelnkoadv(strkodbah,false,true,conbookodlng,conboomiddig,false)) then
      numlangsta = 0 -- 2 known -- 1 unknown -- 0 obviously invalid
    end--if
  end--if

  ---- PROCESS 0...9 OPTIONAL NAMED PARAMS ----

  -- data type "boo" (3+1) (assign a "boo") :
  -- * "nem=" - avoid wall in visible link of type LA LK
  -- * "maj=" - force uppercase
  -- * "noc=" - "true" - this is "nocat" (no error possible)
  -- * "per=" - keep link or category if unknown
  -- multiple choice (2) (assign a "num") :
  -- * "tip=" - base type, 4 possible values (later 5)
  --            0 raw -- 1 LA -- 2 LK -- 3 KE -- (later also: 4 empty)
  -- * "mon=" - type of language name, 4 possible values
  --            0 native -- 1 la -- 2 aj -- 3 sf -- 4 av
  -- string (2...80 octet:s) (3) (fill string and assign a "boo" to "true") :
  -- * "hin=" - name of category KE (lng code will brew the hint)
  -- * "prf=" - prefix before language name
  -- * "err=" - common placeholder

  if (numerr==0) then
    while true do -- fake loop

      boonem = false
      vartmp = arxsomons['nem'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        if (vartmp=="1") then
          boonem = true
        else
          numerr = 10 -- #E10 other param crime
          break
        end--if
      end--if

      boomaj = false
      vartmp = arxsomons['maj'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        if (vartmp=="1") then
          boomaj = true
        else
          numerr = 10 -- #E10 other param crime
          break
        end--if
      end--if

      boonoc = false
      vartmp = arxsomons['noc'] -- optional, NOT prevalidated
      if (vartmp=="true") then
        boonoc = true -- this one needs word "true" and CANNOT cause an error
      end--if

      booper = false
      vartmp = arxsomons['per'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        if (vartmp=="1") then
          booper = true
        else
          numerr = 10 -- #E10 other param crime
          break
        end--if
      end--if

      numbasetipe = 0
      vartmp = arxsomons['tip'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        if (vartmp=="LA") then
          numbasetipe = 1
        end--if
        if (vartmp=="LK") then
          numbasetipe = 2
        end--if
        if (vartmp=="KE") then
          numbasetipe = 3
        end--if
        if (numbasetipe==0) then
          numerr = 8 -- #E08 -- faulty base type
          break
        end--if
      end--if

      nummontip = 0 -- default "raw" / "native"
      vartmp = arxsomons['mon'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        if (vartmp=="la") then
          nummontip = 1
        end--if
        if (vartmp=="aj") then
          nummontip = 2
        end--if
        if (vartmp=="sf") then
          nummontip = 3
        end--if
        if (vartmp=="av") then
          nummontip = 4
        end--if
        if (vartmp=="pl") then
          nummontip = 5
        end--if
        if (nummontip==0) then
          numerr = 10 -- #E10 other param crime
          break
        end--if
      end--if

      boohavehin = false
      vartmp = arxsomons['hin'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        numtamp = string.len (vartmp)
        if ((numtamp>=2) and (numtamp<=80)) then
          strhinhin = vartmp
          boohavehin = true
        else
          numerr = 9 -- #E09 -- crime with "hin=" "prf=" "err="
          break
        end--if
      end--if

      boohaveprf = false
      vartmp = arxsomons['prf'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        numtamp = string.len (vartmp)
        if ((numtamp>=2) and (numtamp<=80)) then
          strprfprf = vartmp
          boohaveprf = true
        else
          numerr = 9 -- #E09 -- crime with "hin=" "prf=" "err="
          break
        end--if
      end--if

      boohaveerr = false
      vartmp = arxsomons['err'] -- optional, NOT prevalidated
      if (type(vartmp)=='string') then
        numtamp = string.len (vartmp)
        if ((numtamp>=2) and (numtamp<=80)) then
          strerarpl = vartmp
          boohaveerr = true
        else
          numerr = 9 -- #E09 -- crime with "hin=" "prf=" "err="
          break
        end--if
      end--if

      break -- finally to join mark
    end--while -- fake loop -- join mark
  end--if

  ---- CHECK FOR CONFLICTING PARAMETERS ----

  -- "tip="  no conflicts possible (only values 0...3 can be
  --                                requested, value 4 not directly)
  --         default is fixed to "raw" 0
  --         may be changed later from "LA" 1 "LK" 2 to "raw" 0 (for 1 reason)
  --                              or from "KE" 2 to "empty" 4 (for 2 reasons)
  -- "nem=1" is illegal for base type "KE" 3 or "raw" 0
  --         default is fixed to false (wall with base type "KE" is separate)
  --         is negative (no-default "1" means "no wall")
  -- "mon="  is illegal for base type "KE" 3
  --         is illegal together with "nem=1"
  --         default is fixed to "native" 0
  -- "maj=1" is illegal for base type "KE" 3
  --         is illegal together with "nem=1"
  --         default is fixed to false (lowercasing separate from this type)
  -- "hin="  is illegal for base type other than "KE" 3
  --         default is fixed to false and empty
  -- "prf="  is illegal for base type "raw" 0
  --         is illegal together with "mon="
  --         is illegal together with "hin="
  --         default is fixed to false and empty
  -- "per=1" is illegal for base type "raw" 0
  --         default is fixed to OFF
  -- "err="  no conflicts possible

  if (numerr==0) then

      if (boonem and ((numbasetipe==0) or (numbasetipe==3))) then
        numerr = 10 -- #E10 other param crime
      end--if

      if ((nummontip~=0) and (numbasetipe==3)) then
        numerr = 10 -- #E10 other param crime
      end--if
      if ((nummontip~=0) and boonem) then
        numerr = 10 -- #E10 other param crime
      end--if

      if (boomaj and (numbasetipe==3)) then
        numerr = 10 -- #E10 other param crime
      end--if
      if (boomaj and boonem) then
        numerr = 10 -- #E10 other param crime
      end--if

      if (boohavehin and (numbasetipe~=3)) then
        numerr = 10 -- #E10 other param crime
      end--if

      if (boohaveprf and (numbasetipe==0)) then
        numerr = 10 -- #E10 other param crime
      end--if
      if (boohaveprf and (nummontip~=0)) then
        numerr = 10 -- #E10 other param crime
      end--if
      if (boohaveprf and boohavehin) then
        numerr = 10 -- #E10 other param crime
      end--if

      if (booper and (numbasetipe==0)) then
        numerr = 10 -- #E10 other param crime
      end--if

  end--if

  ---- CHANGE BASE TYPE IF NEEDED DUE TO NOCAT ----

  if ((numerr==0) and boonoc and (numbasetipe==3)) then
    numbasetipe = 4 -- switch to empty result pseudo type 4
  end--if

  ---- PEEK THE LANGUAGE NAME ----

  -- * tristate "numlangsta" : 2 known -- 1 unknown -- 0 obviously invalid
  -- * from above 2 or 0, now confirm 2 or downgrade to 1 or skip this

  -- for lang name in site language ("c0"):
  -- * type "nil" can become (numlangsta=1) (unknown code) if the site
  --   language code works, otherwise #E02 (broken submodule)
  -- * "-" is unconditionally evil with #E02 (broken submodule)

  -- here we depend on "constrpriv" and submodule "loaddata-tbllingvoj"

  if ((numerr==0) and (numbasetipe~=4) and (numlangsta==2)) then

    while true do -- fake loop
      vartmp = tablg76yleft[strkodbah]
      if (type(vartmp)~='string') then
        if (type(tablg76yleft[constrpriv])=='string') then
          numlangsta = 1 -- unknown code given (site code works)
        else
          numerr = 2 -- #E02 broken submodule (site code does NOT work either)
        end--if
        break
      end--if
      if (string.len(vartmp)<2) then -- less than 2 letters is not legal
        numerr = 2 -- #E02 broken submodule
        break
      end--if
      strnambah = vartmp -- got lang name :-)
      break -- finally to join mark
    end--while -- fake loop -- join mark

  end--if

  ---- WHINE IF YOU MUST #E02...#E99 ----

  -- reporting depends on uncommentable strings

  if (numerr>1) then
    if (numerr==3) then -- #E03
      strviserr = lfhbrewerrsm(numerr,constringvoj,num2statcode) -- 2 lines
    else
      strviserr = lfhbrewerrsm(numerr) -- 1 line
    end--if
  end--if

  ---- CHANGE BASE TYPE AND MON TYPE TO RAW IF NEEDED DUE TO BAD CODE ----

  -- only if code is bad (obviously invalid 0 or unknown 1) and
  -- "per=1" was NOT used then change base type "LA" 1 or "LK" 2 to type
  -- "raw" 0, and base type "KE" 3 to empty result AKA pseudo type 4

  -- if code is bad then always reset "mon=" type to "raw" 0

  if ((numerr==0) and (numlangsta~=2) and (not booper)) then
    if ((numbasetipe==1) or (numbasetipe==2)) then
      numbasetipe = 0 -- switch to type "raw"
    end--if
    if (numbasetipe==3) then
      numbasetipe = 4 -- switch to empty result AKA pseudo type 4
    end--if
  end--if

  if ((numerr==0) and (numlangsta~=2)) then
    nummontip = 0 -- default "raw" / "native"
  end--if

  ---- APPLY PLACEHOLDERS FOR BAD CODES ----

  if ((numerr==0) and (numbasetipe~=4)) then

    if (boohaveerr) then -- have "err="
      strtamp = strerarpl -- common placeholder
      strtymp = strerarpl -- common placeholder
    else
      strtamp = constrevid -- invalid
      strtymp = constrneli -- unknown
    end--if
    if (numlangsta==0) then
      strnambah = strtamp -- invalid
    end--if
    if (numlangsta==1) then
      strnambah = strtymp -- unknown
    end--if

  end--if

  ---- BREW THE VISIBLE PART FOR RAW OR FOR LINK ----

  -- strkodbah   : lang code (not needed anymore here)
  -- strnambah   : language name (without prefix "Bahasa")
  --               always >= 2 letters (from above)
  -- strnambauc  : language name uppercased begin ("Angla") (brew here)
  -- strnambaty  : language name processed according to "mon="
  --               and "maj=1" (brew here)
  -- numbasetipe : 0 raw -- 1 LA -- 2 LK colon YES -- 3 KE -- 4 empty
  -- nummontip   : 0 native -- 1 la -- 2 aj -- 3 sf -- 4 av -- 5 pl
  -- boomaj

  if ((numerr==0) and (numbasetipe~=4)) then
    strnambauc = lfucasestr (strnambah,true,false,2) -- make upper one letter
    strnambaty = lfivarilingvonomo (strnambah, nummontip, boomaj)
  end--if

  ---- CARRY OUT THE TRIVIAL WORK WITH BASE TYPE (0) RAW ----

  if ((numerr==0) and (numbasetipe==0)) then
    strvisgud = strnambaty
  end--if

  ---- CARRY OUT THE HARD WORK WITH TYPE (1,2,3) LINK OR CAT INSERTION ----

  -- numbasetipe : 0 raw -- 1 LA -- 2 LK colon YES -- 3 KE -- 4 empty

  -- "prf=" is legal for all LA LK KE but not together with "hin="

  do -- scope
    local strbasepagename = ''
    local strprefix = '' -- "Appendix:" 1 or ":Category:" 2 or "Category:" 3
    local strbefore = '' -- before wall (link target)
    local strafteer = '' -- aft wall (visible link text) (no wall if this empty)

    if ((numerr==0) and (numbasetipe~=0) and (numbasetipe~=4)) then

    if (numbasetipe==1) then
      strprefix = constraldp -- LA "Appendix:"
    end--if
    if (numbasetipe==2) then
      strprefix = ":" .. constrkatp -- LK ":Category:"
    end--if
    if (numbasetipe==3) then
      strprefix = constrkatp -- KE "Category:"
    end--if

    if (boohaveprf) then
      strbasepagename = strprfprf .. " (" .. strnambah .. ")" -- no force uppercase
    else
      strbasepagename = strnambauc -- force uppercased begin
    end--if

    if (numbasetipe==3) then
      if (boohavehin) then
        strbefore = strhinhin
        strafteer = lfibrewcathint (strnambah,2,false)
      else
        strbefore = strbasepagename
        strafteer = '' --  no wall is tolerable
      end--if
    else
      strbefore = strbasepagename
      if (boonem) then
        strafteer = '' --  no wall is tolerable in visible link of type LA LK
      else
        strafteer = strnambaty -- augmented language name
      end--if
    end--if (numbasetipe==3) else

      strvisgud = "[[" .. strprefix .. strbefore -- prefix ends with colon ":"
      if (strafteer~='') then
        strvisgud = strvisgud .. "|" .. strafteer
      end--if
      strvisgud = strvisgud .. "]]"

    end--if ((numerr==0) and (numbasetipe~=0) and (numbasetipe~=4)) then

  end--do scope

  ---- RETURN THE JUNK STRING ----

  if (numerr==0) then -- no separate string for cat:s here
    strret = strvisgud
  else
    strret = strviserr
  end--if
  return strret -- can be empty

end--function

  ---- RETURN THE JUNK LUA TABLE ----

return exporttable