[ Prev | Index | Next ]
Japanese English

Step 4 - How to Add Functions/Variables by Scripts
(Library Scripts)

In this page, as an advanced step of script execution, Let's define variables/functions and use them in calculations.

You can define variables and functions in script files in "lib" folder, and use them in expressions of the Step-1 and Step-2, and in scripts of the Step-3. Scripts for providing functions/variables is referred as "library scripts" on the RINPn and the Vnano.

How to Use Library Scripts

There is an example library script "ExampleLibrary.vnano" in "lib" folder, and it is set to be loaded by default.

An example library script "ExampleLibrary.vnano" is in "lib" folder, and it is set to be loaded by default. The content of this example script is as follows:

(The content of "ExampleLibrary.vnano" in "lib" folder)

float libvar = 2.0;

float libfun(float x) {
    float result = libvar * x + 1;
    return result;
}
As a side note, in the Vnano, the precision of "float" type is 64-bit, as same as the "double".

In the expression/script inputted to the RINPn (see Step-1, Step-2, and Step-3), you can use variables and functions defined in the above "ExampleLibrary.vnano", as the following example:

INPUT:
1 + libvar

OUTPUT:
3

INPUT:
libfun(1.23)

OUTPUT:
3.46

How to Add New Library Scripts

If you want, you can create other (new) library script files, and define functions/variables in it.

When you have created/appended new library script files, describe its file path in the content of the text file "VnanoLibraryList.txt" in "lib" folder, for loading it.



Sponsored Link



Japanese English
Index of this category
News

Software Updates: Command Expansion in RINEARN Graph, and English Support in VCSSL
2024/02/05 - We updated our apps. This updates include "Enhancing the Command-Line Features of RINEARN Graph" and "Adding English Support to VCSSL." Delves into each of them!

Inside the Repetitive Execution Speedup Impremented in Vnano Ver.1.1
2024/01/17 - Delves into the update in Vnano 1.1 from a developer's viewpoint, providing detailed insights into the specific improvements made to the internal structure of the script engine.

Scripting Engine Vnano Ver.1.1 Released: Dramatic Speed Improvement for Repetitive Executions of the Same Content
2023/12/22 - Released the Vnano script engine Ver.1.1. In this version, we've made significant enhancements in processing speed by reducing the overhead of handling requests. Explains the details.

Code Archive
Circular Wave Animation

Draws the circular wave as 3D animation, under the specified wave parameters.
2022-12-14
Sine Wave Animation

Draws the sine wave as animation, under the specified wave parameters.
2022-11-26
Tool For Converting Units of Angles: Degrees and Radians

A GUI tool for converting the angle in degrees into radians, or radians into degrees.
2022-11-22
Fizz Buzz Program

A program printing the correct result of Fizz Buzz game.
2022-05-12
Vnano | Solve The Lorenz Equations Numerically

Solve the Lorenz equations, and output data to plot the solution curve (well-known as the "Lorenz Attractor") on a 3D graph.
2021-02-18
» More