Skip to content

Pre3.9 - Functions, redo, and string manipulations !

Pre-release
Pre-release
Compare
Choose a tag to compare
@megat69 megat69 released this 05 Dec 16:57
· 42 commits to master since this release
2d9ec72

Pre3.9

  • IDE
    • Added a memory system to the IDE
    • Every time you close the IDE, it will save the last cursor position, and it will set the cursor to the correct position once you open this file again.
  • Redo
    • New console command
    • Re-iterates the last action you did
  • String manipulations
  • 2 new var_actions : replace and split
    • replace
      • Replaces elements of the string.
      • Syntax : --replace:"<element_to_replace>""<replace_with>"["count"]
      • The first count element_to_replace will be searched through the string and replaced by the replace_with.
      • If count is undefined, all the element_to_replace will be replaced by replace_with.
      • Example 1 (Without count) : var:str--replace:"e""a" Test = Yeeeeeeeeeeeeeeeee will result in Yaaaaaaaaaaaaaaaaa
      • Example 2 (With count) : var:str--replace:"e""a""3" Test = Yeeeeeeeeeeeeeeeee will result in Yaaaeeeeeeeeeeeeee
    • split
      • Splits the string into a string
      • Syntax : --split:"<separator>"
      • Example 1 : var:str--split:" " Test = This is a test string. will result in ['This', 'is', 'a', 'test', 'string.']
      • Example 2 : var:str--split:"ng " Test = Testing string :D will result in ['Testi', 'stri', ':D']
  • FUNCTIONS
    • Biggest feature of the update
    • Functions allow to write some code once and reuse it as much as you want.
    • How to define a function (without parameters) ?
      • Type function <name>
      • Write the code of the function under it
      • End by endfunction or end function
    • How can I call a function (without parameters) ?
      • Type use_function <function_name>
    • How to define a function (with parameters) ?
      • Add the parameter names (separated by spaces) after the function <name>
      • You can then use them inside the function as normal variables. But if you modify them, they'll become global variables.
      • Example : function hello first_name last_name
    • How can I call a function (with parameters) ?
      • Add the values of the parameters after the use_function <function_name>, separated by spaces.
      • They can be hardcoded values, variables, or equations.
      • Example, following the function defined above : use_function hello TheAssassin71 {last_name}