Introduction

AxScript is built on top of the JavaScript engine from Qt's JSEngine framework. AxScript shares the same syntax as JavaScript:

  • variable definition and basic operations

let a = 5 + 23;  // let - block environment
if (a > 12) {
    var b = 12;  // var - global (func) environment
}
ax.log(b)        // print: 12
  • Basic String operations

// Create
let str1 = "Hello";
let str2 = 'World';
let str3 = `Hello ${str2}`;     // Hello World

// Operations
"Hello" + " " + "World"	        // "Hello World"
"Hello".length	                // 5
"Hello"[1]	                // "e"
"Hello".includes("ell")	        // true
"Hello".replace("llo", "y")	// "Hey"
"a,b,c".split(",")	        // ["a", "b", "c"]
"Hello".slice(1, 3)	        // "el"
"Hello".toUpperCase()	        // "HELLO"

// ... And other string JS operations
  • Basic Array operations

  • Basic Map/Object operations

  • Function Declaration

  • Functions and parameters

  • You can interrupt the execution of a function or script and pass the error to the underlying client using throw.

  • Regular Expressions

This is a small and incomplete example of what AxScript can do. For more information, see the Javascript reference.

Last updated