Data processing on the script language Lua

Top Next

For simplicity and convenience of processing large amounts of data in programs on C ++   there can be used scripting programming language Lua, the language of a writing and performance of the scenario (script).

In Lua there are means for performance of mathematical functions, processing of files, tables of metadata.

Dialog for interactive input and performance of scripts looks like:

 

_engbm416

 

For calculations of semantic characteristics the dialog takes into consideration the objects that are marked on maps, and the objects for which the filter of search is set by the Filter dialog button.

Script window serves to input various computing operations in which the built-in functions, listed in the field of dialog the Hints for writing a script, can be used. By double-clicking the left mouse button on a line of hints the chosen function is copied into the field of script input.

In one scenario (script) presence of arbitrary number of operations for calculations of semantic characteristics is admissible.

For example, the area of the object to multiply by the length from semantics with the code 1 and to remember the received value in the semantics with the code 7 (codes depend on the map classifier):

value = getSquare() * getCodeSem(2)

setCodeSem(7, value)

If parameter of the built-in function in a script is a string value, it must be put in double or single quotes.

For easy selection of semantics codes in the right side of the dialog window the list of semantics of the map classifier is specified. Semantics list is opened only for viewing.

The script upon termination of implementation process is automatically saved in folder LOG for an open map. The filename of a script is made up of a name of a map and symbols "temp.lua".

The errors that occurred during the execution of calculations under the scenario are placed into the report of the program's work and can be viewed by activation of the button Error log.

 

Examples of Lua scripts.