Other Functions

<< Click to Display Table of Contents >>

Navigation:  Multi-Protocol MasterOPC Server > Lua 5.1 Reference Manual > Function library > The OTHERS Library >

Other Functions

Other Functions

mbul_mail others.CreateProcess

mbul_mail others.TerminateProcess

mbul_mail others.Ping

mbul_mail others.Sleep

mbul_mail others.GetStringFieldByName

mbul_mail others.GetStringFieldByNumber

others.CreateProcess

Launches a process.

Function arguments are:

mbul   1 (STRING) – filename (as a rule, *.exe)

mbul   2 (STRING) – command line

mbul   3 (STRING) – work folder

mbul   4 (INT) – console visibility (0 – do not hide, 1 – hide)

The function returns

mbul   err (BOOL) – error (false – no error, true – error)

mbul   Pid (table) – process identifier

others.TerminateProcess

Terminates a process.

The function argument is a table Pid (see others.CreateProcess ).

others.Ping

Executes ping of IP address defined.

Function arguments are

mbul   1 (STRING) – IP address or a DNS name

mbul   2 (INT) –  query timeout

The function returns 2 parameters:

mbul   err (BOOL) – error (false – no errors, true – error);

mbul   Time (INT) – query time by milliseconds in case of successful query; nil in case of an error

Example

err,Time = others.Ping("google.com",1000);

if err then

   server.Message("ping error");

else

   server.Message("ping success time = ",Time);    

end

others.Sleep

Produces a delay in script execution. A delay time by milliseconds is specified in parenthesis. There are no arguments returned.

Example

others.Sleep(1000); --the script will be stopped for 1000 ms.

others.GetStringFieldByName

Returns 2 parameters:

mbul   err (BOOL) – error (false – no error, true – error)

mbul   content (STRING) – content of a specified field of CSV file.

The function argument is a field name (STRING).

This function is available only in a script of a tag import template (see The Map Template Editor in the Tag Import section).

others.GetStringFieldByNumber

Returns 2 parameters:

mbul   err (BOOL) – error (false – no error, true – error)

mbul   content (STRING) – content of a specified field of CSV file.

The function argument is a field number (INT).

This function is available only in a script of a tag import template (see The Map Template Editor in the Tag Import section).