Text Input Library

  • FeynmanLogomaker
    17th Oct 2013 Member 0 Permalink

    Well, I'm not sure if it can really be called a library - it only has 2 global functions - but it's still pretty useful for prompting a user for a lot of text.

     

    More details are in comments in the code.

     

    The code is here.

     

    Version Changed Added Removed
    1.0   Initial script outline  
    1.2 Changed text spacing Added text input cursor  
    1.5 Changed cursor from simple line to terminal-style block Added uppercase/lowercase control with SHIFT  
    1.8   Added backspace option
    Added more SHIFT control
     
    2.0   Closes when the user presses ESCAPE Removed printing of chardata as you type - not needed anymore, it was just for debugging
    2.5     Now stops registering more text after the user has pressed escape
    2.8   Added function to retrieve text  
           
           
           

     

    Edited once by FeynmanLogomaker. Last: 17th Oct 2013
  • Nobody905
    17th Oct 2013 Member 0 Permalink

    So much text stuff...

    This isn't Microsoft Word you know.

  • mniip
    17th Oct 2013 Developer 0 Permalink
    ({string.gsub(s, '[a-z]', 'MAT')})[1] == 'MAT'
    i fail to see what did you want to achieve with this.....
    why are you creating a table and then fetching its first element, can't you simply write
    string.gsub(s, '[a-z]', 'MAT') == 'MAT'
    now it becomes more clear that what you want is to see if a string is a single uppercase character....
    string.match(s, '^[a-z]$') (s is a single character anyway though)

    then, second question, whats the point of this whole thing, you can't even edit properly
  • FeynmanLogomaker
    17th Oct 2013 Member 0 Permalink

    This I was just making for the fun of it. I'm not expecting people to use it, I just wanted a way to input lots of multiline text in a way other than using a TPT-supplied interface or lots of tpt.input()s.

    Edited once by FeynmanLogomaker. Last: 17th Oct 2013