Getting started

ProcScript: Scripting Made Easy

ProcFu uses ProcScript as its main scripting language. ProcScript is easy to use, especially if you know PHP, because it's quite similar. It also takes some good parts from JavaScript to make it even more useful. Plus, it's very forgiving, so even beginners can work with it without getting stuck on small mistakes.

Comments

Single lines start with //, while multi-line comments are enclosed in /* */.

Case Insensitivity

Keywords are not case-sensitive for increased flexibility.

Untyped Variables

Variables are adaptable and can hold any data type. If a variable lacks a value, it defaults to NULL.

Returning Data

Use YIELD and RETURN statements to return data to the calling program.

String Concatenation

One key difference between ProcScript and PHP is how they use the + sign. In ProcScript, similar to JavaScript, + is used for string concatenation, unlike PHP which uses the dot operator (.).

ProcScript's + sign is also smarter in a way. It can change the types of things it's adding together to make them work better and give a result that makes sense.

Here's a breakdown of examples to illustrate this difference:

x = [1,2,3]; 
print x + 5; 

// Output -  [1,2,3,5]

x = 100
print x + 5

// Output -  105

x = "Test"
print x + 5

// Output -  Test5

Use ProcFu Functions Easily in ProcScript

In ProcScript, you can use the full library of ProcFu functions. Just call them as you would with any regular function.

name = "John"
greeting = HELLO_WORLD(name)  // Call ProcFu function using its name
PRINT greeting  

// Output - Hello John

Effortless Data Exchange:

ProcScript handles JSON conversion automatically, ensuring smooth communication between your script and ProcFu functions.

  • Inputs and Outputs: Usually, ProcFu scripts take text as input and give text as output. You can easily send arrays to ProcFu functions and expect arrays or objects back.
  • Returning Complex Data: If your script has to send back arrays or objects, ProcScript turns them into JSON automatically, so they fit right in with the calling system.

This automatic change means you don't have to manually adjust the data, making working with ProcFu much easier.

Multi-Line Content

ProcScript usually needs commands to be on one line. If you split commands across lines, it might cause errors or things not to work as expected.

Exceptions Accommodating Multi-Line Content

Strings: Create multi-line strings using triple quotes, as in Python. Example:


text = """This is
a multi-line
string
"""

Objects and Arrays: Extend these over multiple lines, ensuring each key-value pair remains on a single line. Examples:


arr = [
    "foo" => "bar",
    "baz" => 42
]

obj = {
    foo: "bar",
    baz: 42
}

Accessing Object Values in ProcScript: Dot-Notation and Array Notation

While ProcScript offers both dot-notation and array notation for accessing object values, array notation is generally recommended due to its wider applicability.

Universal Access with Array Notation: Use array notation (square brackets []) to access any object property regardless of its key structure. This ensures consistent and reliable retrieval of values.

Limited Use Case for Dot-Notation: Dot-notation (using the dot .) can be employed for improved readability, but it does not work if the key has a hyphen in it.

object = {
  "name": "John",
  "user-status": "Active",
}

// The following are correct. They will work.

print object["name"] 
print object["user-status"]
print object.name

// The following is incorrect. It Will NOT work.

print object.user-status