"Swap" - Bool/Position/Value  : Array / Matrix / Var Autoswap
//This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//©kaigouthro
//@version=5
// @description # Side / Boundary Based All Types Swapper
// - three automagic types for Arrays, Matrixes, and Variables
//     - no signal     : Long/ Short positon autoswap
//     - true / false  : Boolean based side choice
//     - Src / Thresh  : if source is above or  below the threshhold
// - two operatng modes for variables, Holding mode only for arrays/matrixes
//     - with two   items, will automatically change btween the two caveat is it does not delete table/box/line(fill VAR items automatically)
//     - with three items, a neutral is available for NA input or neutral
// - one function name for all of them. One import name that's easy to type/remember
//     - make life easy for your conditionala.
library("swap",true)

// @function src     helper function for side
// @param    source  value input      
// @param    thresh  boundary line to cross
// @param    _a      value 1
// @param    _b      value 2
// @param    _c      value 3
_side (src, thresh,_a,_b,_c)   =>
    var value  = src
    var border = thresh
    value      := src
    border     := thresh
    switch 
        value > thresh  =>   _a
        value < thresh  =>   _b
        => _c
        
// @function src     helper function for side boolean 
// @param    _isTrue value input      
// @param    _a      value 1
// @param    _b      value 2
// @param    _c      value 3
_sidebool (_isTrue,_a,_b,_c)   =>
    switch _isTrue
        true   =>   _a
        false  =>   _b
        => _c
    
// @function src     helper function for overloads 
// @param    _a      if Long    position Item
// @param    _b      if Short   position Item
// @param    _c      if neutral position Item
_positionSwapper    (_a,_b,_c)   =>
    _side (strategy.position_size,0,_a,_b,_c) 




// @function side    Change outputs based on position or a crrossing level
// 
// - three automagic types for Arrays, Matrixes, and Variables
//     - no signal     : Long/ Short positon autoswap
//     - true / false  : Boolean based side choice
//     - Src / Thresh  : if source is above or  below the threshhold
// - two operatng modes for variables, Holding mode only for arrays/matrixes
//     - with two   items, will automatically change btween the two caveat is it does not delete table/box/line(fill VAR items automatically)
//     - with three items, a neutral is available for NA input or neutral
// - one function name for all of them. One import name that's easy to type/remember
//     - make life easy for your conditionala.
//
// # simple local methods to add:
// import kaigouthro/swap/1
// > this will allow local use easy
// ```
// method swwap(float s, float t, a,b,c) => swap.side(s,t,a,b,c)
//
// // var _held = "your value"
// // example_held = _src.swap(_threshold, item1,item2,_held)
// method swwap(bool  t, a,b,c         p) => swap.side(t,a,b,c)
//
// // var _held = "your value"
// // example_held = _bool_var.swap(item1,item2,_held)
//
// ```
// @param    source  (float)  OPTIONAL value    input      
// @param   thresh   (float)  OPTIONAL boundary line to cross
// @param    _a      (any)    if Long/True/Above
// @param    _b      (any)    if Short/False/Below
// @param    _c      (any)    OPTIONAL Neutral Item, if var/varip on a/b it will leave behind, ie, a table or box or line will not erase , if it's a varip you're sending in. 
// @returns first, second, or third items based on input conditions
export side (                          bool       _a ,  bool       _b,  bool       _c  = na) =>  _d  =  bool     (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == bool     (na) ? out : _d)
export side (                          box        _a ,  box        _b,  box        _c  = na) =>  _d  =  box      (_c),                 out  = _positionSwapper                   ( _a, _b, _d )
export side (                          color      _a ,  color      _b,  color      _c  = na) =>  _d  =  color    (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == color    (na) ? out : _d)
export side (                          float      _a ,  float      _b,  float      _c  = na) =>  _d  =  float    (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == float    (na) ? out : _d)
export side (                          int        _a ,  int        _b,  int        _c  = na) =>  _d  =  int      (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == int      (na) ? out : _d)
export side (                          label      _a ,  label      _b,  label      _c  = na) =>  _d  =  label    (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == label    (na) ? out : _d)
export side (                          line       _a ,  line       _b,  line       _c  = na) =>  _d  =  line     (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == line     (na) ? out : _d)
export side (                          linefill   _a ,  linefill   _b,  linefill   _c  = na) =>  _d  =  linefill (_c),                 out  = _positionSwapper                   ( _a, _b, _d )
export side (                          string     _a ,  string     _b,  string     _c  = na) =>  _d  =  string   (_c), var out = _d,   out := _positionSwapper                   ( _a, _b, _d == string   (na) ? out : _d)
export side (                          table      _a ,  table      _b,  table      _c  = na) =>  _d  =  table    (_c),                 out  = _positionSwapper                   ( _a, _b, _d )
export side ( float src, float thresh, bool       _a ,  bool       _b,  bool       _c  = na) =>  _d  =  bool     (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == bool     (na) ? out : _d)
export side ( float src, float thresh, box        _a ,  box        _b,  box        _c  = na) =>  _d  =  box      (_c),                 out  = _side            (src     , thresh , _a, _b, _d )
export side ( float src, float thresh, color      _a ,  color      _b,  color      _c  = na) =>  _d  =  color    (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == color    (na) ? out : _d)
export side ( float src, float thresh, float      _a ,  float      _b,  float      _c  = na) =>  _d  =  float    (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == float    (na) ? out : _d)
export side ( float src, float thresh, int        _a ,  int        _b,  int        _c  = na) =>  _d  =  int      (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == int      (na) ? out : _d)
export side ( float src, float thresh, label      _a ,  label      _b,  label      _c  = na) =>  _d  =  label    (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == label    (na) ? out : _d)
export side ( float src, float thresh, line       _a ,  line       _b,  line       _c  = na) =>  _d  =  line     (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == line     (na) ? out : _d)
export side ( float src, float thresh, linefill   _a ,  linefill   _b,  linefill   _c  = na) =>  _d  =  linefill (_c),                 out  = _side            (src     , thresh , _a, _b, _d )
export side ( float src, float thresh, string     _a ,  string     _b,  string     _c  = na) =>  _d  =  string   (_c), var out = _d,   out := _side            (src     , thresh , _a, _b, _d == string   (na) ? out : _d)
export side ( float src, float thresh, table      _a ,  table      _b,  table      _c  = na) =>  _d  =  table    (_c),                 out  = _side            (src     , thresh , _a, _b, _d )
export side ( bool _istrue           , bool       _a ,  bool       _b,  bool       _c  = na) =>  _d  =  bool     (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == bool     (na) ? out : _d)
export side ( bool _istrue           , box        _a ,  box        _b,  box        _c  = na) =>  _d  =  box      (_c),                 out  = _sidebool                 (_istrue , _a, _b, _d )
export side ( bool _istrue           , color      _a ,  color      _b,  color      _c  = na) =>  _d  =  color    (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == color    (na) ? out : _d)
export side ( bool _istrue           , float      _a ,  float      _b,  float      _c  = na) =>  _d  =  float    (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == float    (na) ? out : _d)
export side ( bool _istrue           , int        _a ,  int        _b,  int        _c  = na) =>  _d  =  int      (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == int      (na) ? out : _d)
export side ( bool _istrue           , label      _a ,  label      _b,  label      _c  = na) =>  _d  =  label    (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == label    (na) ? out : _d)
export side ( bool _istrue           , line       _a ,  line       _b,  line       _c  = na) =>  _d  =  line     (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == line     (na) ? out : _d)
export side ( bool _istrue           , linefill   _a ,  linefill   _b,  linefill   _c  = na) =>  _d  =  linefill (_c),                 out  = _sidebool                 (_istrue , _a, _b, _d )
export side ( bool _istrue           , string     _a ,  string     _b,  string     _c  = na) =>  _d  =  string   (_c), var out = _d,   out := _sidebool                 (_istrue , _a, _b, _d == string   (na) ? out : _d)
export side ( bool _istrue           , table      _a ,  table      _b,  table      _c  = na) =>  _d  =  table    (_c),                 out  = _sidebool                 (_istrue , _a, _b, _d )
export side (                          bool[]     _a ,  bool[]     _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          box[]      _a ,  box[]      _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          color[]    _a ,  color[]    _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          float[]    _a ,  float[]    _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          int[]      _a ,  int[]      _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          label[]    _a ,  label[]    _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          line[]     _a ,  line[]     _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          linefill[] _a ,  linefill[] _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          string[]   _a ,  string[]   _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                          table[]    _a ,  table[]    _b                      ) => var out = _b, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side ( float src, float thresh, bool[]     _a ,  bool[]     _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, box[]      _a ,  box[]      _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, color[]    _a ,  color[]    _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, float[]    _a ,  float[]    _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, int[]      _a ,  int[]      _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, label[]    _a ,  label[]    _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, line[]     _a ,  line[]     _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, linefill[] _a ,  linefill[] _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, string[]   _a ,  string[]   _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh, table[]    _a ,  table[]    _b                      ) => var out = _b, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( bool _istrue           , bool[]     _a ,  bool[]     _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , box[]      _a ,  box[]      _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , color[]    _a ,  color[]    _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , float[]    _a ,  float[]    _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , int[]      _a ,  int[]      _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , label[]    _a ,  label[]    _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , line[]     _a ,  line[]     _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , linefill[] _a ,  linefill[] _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , string[]   _a ,  string[]   _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           , table[]    _a ,  table[]    _b                      ) => var out = _b, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side (                           matrix<bool>     _a ,  matrix<bool>     _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<box>      _a ,  matrix<box>      _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<color>    _a ,  matrix<color>    _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<float>    _a ,  matrix<float>    _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<int>      _a ,  matrix<int>      _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<label>    _a ,  matrix<label>    _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<line>     _a ,  matrix<line>     _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<linefill> _a ,  matrix<linefill> _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<string>   _a ,  matrix<string>   _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side (                           matrix<table>    _a ,  matrix<table>    _b         ) => var out = _a, _c = out[1], out := _positionSwapper                               ( _a, _b, _c)
export side ( bool _istrue           ,  matrix<bool>     _a ,  matrix<bool>     _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<box>      _a ,  matrix<box>      _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<color>    _a ,  matrix<color>    _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<float>    _a ,  matrix<float>    _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<int>      _a ,  matrix<int>      _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<label>    _a ,  matrix<label>    _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<line>     _a ,  matrix<line>     _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<linefill> _a ,  matrix<linefill> _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<string>   _a ,  matrix<string>   _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( bool _istrue           ,  matrix<table>    _a ,  matrix<table>    _b         ) => var out = _a, _c = out[1], out := _sidebool                          (_istrue    , _a, _b, _c)
export side ( float src, float thresh,  matrix<bool>     _a ,  matrix<bool>     _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<box>      _a ,  matrix<box>      _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<color>    _a ,  matrix<color>    _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<float>    _a ,  matrix<float>    _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<int>      _a ,  matrix<int>      _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<label>    _a ,  matrix<label>    _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<line>     _a ,  matrix<line>     _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<linefill> _a ,  matrix<linefill> _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<string>   _a ,  matrix<string>   _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)
export side ( float src, float thresh,  matrix<table>    _a ,  matrix<table>    _b         ) => var out = _a, _c = out[1], out := _side                     (src     , thresh    , _a, _b, _c)










// demo 

testtbl (table _tb, int _num,  _string,  _value , _col)                                                                                                                 =>  //  {
    _cellvalue      =  str.tostring(_value)
    table.cell(_tb, 0, _num, _string    , 0, 0, color.new(_col, 30),'left' ,   'bottom' , size.normal )
    table.cell(_tb, 1, _num, _cellvalue , 0, 0, color.new(_col, 30),'right',   'bottom' , size.normal )

testln  (int dist = 20, string xloc=xloc.bar_index, string extend=extend.none, color color=#33aaff, string style=line.style_solid, int width=1)                                                   => //{
    ln = line(na)
    line.delete(ln[1])
    ln := line.new(last_bar_index, close, last_bar_index - dist, close[dist], xloc=xloc, extend=extend, color=color, style=style, width=width)
    
testlnf (line l1,line l2)                                                                                                                                                                         => //{
    var ln = linefill(na)
    linefill.delete(ln)
    ln := linefill.new(l1,l2,color.new(color.orange,80))

testlbl (float _y=high, string _text="Your text here", int _x=bar_index, color _color=color.white) =>
    var ln = label(na)
    label.delete(ln[1])
    ln := label.new(_x,_y,_text,xloc.bar_index, yloc.price, _color, label.style_label_down, color.black, size.large)

dist   = input(3)

var   color   _demo_colora  = na
var   color   _demo_colorb  = na
var   color   _demo_colorc  = na
var   color   _demo_colord  = na
var   color   _demo_colore  = na
varip bool    _demo_bool    = na
varip int     _demo_int     = na
varip float   _demo_float   = na
varip string  _demo_string  = na
varip string  _desca        =  'Is This Below ? '          
varip string  _descb        =  'Lower value Bar Index '    
varip string  _descc        =  'Lower item Value  '        
varip string  _descd        =  'further item is '          
varip string  _desce        =  'Linefill is on '           

_stringsa  = array.from('Array 1 - a' ,'Array 1 - b' ,'Array 1 - c' ,'Array 1 - d' ,'Array 1 - e' )
_stringsb  = array.from('Array 2 - e' ,'Array 2 - d' ,'Array 2 - c' ,'Array 2 - b' ,'Array 2 - a' )

stringarr = side(dayofmonth>15,_stringsa,_stringsb)


_demo_colora :=  side (close[2*dist] , close          ,  color.green            ,  color.orange    ,  color.gray     )   
_demo_colorb :=  side (close[3*dist] , close          ,  color.green            ,  color.orange    ,  color.gray     )   
_demo_colorc :=  side (close[4*dist] , close          ,  color.green            ,  color.orange    ,  color.gray     )   
_demo_colord :=  side (close[5*dist] , close          ,  color.green            ,  color.orange    ,  color.gray     )   
_demo_colore :=  side (close[  dist] , close          ,  color.yellow           ,  color.fuchsia   ,  color.gray     )   
_demo_bool   :=  side (close         , close [2*dist] ,  true                   ,  false           ,  na             )    
_demo_int    :=  side (close         , close [3*dist] ,  bar_index[3*dist]      ,  last_bar_index  ,  0              )    
_demo_float  :=  side (close         , close [4*dist] ,  close    [4*dist]      ,  close           ,  _demo_float[1] )    
_demo_string :=  side (close         , close [5*dist] , 'Below Close'           , 'Above Close '   , 'Equal'         )    

ln1          = testln(2*dist)
ln2          = testln(3*dist)
ln3          = testln(4*dist)
ln4          = testln(5*dist)

line1        = side(_demo_bool,ln1,ln3)
line2        = side(_demo_bool,ln2,ln4) 

testlnf(line1,line2)

_stringlinechoise = side(_demo_bool, 'ln1,ln3', 'ln2,ln4') 


testlbl(close[2*dist] , _desca   + str.tostring(_demo_bool        ), bar_index - 2*dist , _demo_colora)
testlbl(close[3*dist] , _descb   + str.tostring(_demo_int         ), bar_index - 3*dist , _demo_colorb)
testlbl(close[4*dist] , _descc   + str.tostring(_demo_float       ), bar_index - 4*dist , _demo_colorc)
testlbl(close[5*dist] , _descd   + str.tostring(_demo_string      ), bar_index - 5*dist , _demo_colord)
testlbl(close         , _desce   + str.tostring(_stringlinechoise ), bar_index          , _demo_colore)


table _tba = table.new('bottom_left'  , 20, 20, color.new(#333333, 80), na, 1, na)
table _tbb = table.new('bottom_right' , 20, 20, color.new(#333333, 80), na, 1, na)
table _tbc = table.new('bottom_center', 20, 20, color.new(#333333, 80), na, 1, na)

_tabis = table(na)

_tabis := side(close>open and input(true,'table swap'), _tba,_tbb, na)

_htest = side(barstate.isfirst?open:close,close,'| Two options, holding first',  '| ERROR if this showed', input(true,'Test holding last value')?  na : '| Three options, Showing Third')

testtbl(_tbc , 0, close>open ? " <<<<< Table should be" : "Table should be >>>>>>" , _htest  , color.white)

testtbl(_tabis, 1, _desca , _demo_bool        , _demo_colora)
testtbl(_tabis, 2, _descb , _demo_int         , _demo_colorb)
testtbl(_tabis, 3, _descc , _demo_float       , _demo_colorc)
testtbl(_tabis, 4, _descd , _demo_string      , _demo_colord)
testtbl(_tabis, 5, _desce , _stringlinechoise , _demo_colore)

for i = 0 to array.size(stringarr)-1
    testtbl(_tabis, i + 6, array.get(stringarr,i) , 'upside down or right side up for swap' , color.yellow)
