Basic API VIs

LuaVIEW Close.vi LuaVIEW Pull (poly).vi re_LuaVIEW Call.vi re_LuaVIEW Execute.vi
LuaVIEW Compile.vi LuaVIEW Push (poly).vi re_LuaVIEW Do Script.vi re_LuaVIEW Run Task.vi
LuaVIEW Open.vi LuaVIEW Swap Task.vi re_LuaVIEW Do Task.vi

Polymorphic data exchange alternatives

LuaVIEW Pull (I16).vi LuaVIEW Pull (number).vi LuaVIEW Push (U16).vi LuaVIEW Push (path).vi
LuaVIEW Pull (I32).vi LuaVIEW Pull (object).vi LuaVIEW Push (U32).vi LuaVIEW Push (refnum).vi
LuaVIEW Pull (I8).vi LuaVIEW Pull (path).vi LuaVIEW Push (U8).vi LuaVIEW Push (string).vi
LuaVIEW Pull (U16).vi LuaVIEW Pull (refnum).vi LuaVIEW Push (boolean).vi re_LuaVIEW Pull (flat data).vi
LuaVIEW Pull (U32).vi LuaVIEW Pull (string).vi LuaVIEW Push (flat data).vi re_LuaVIEW Push (flat data).vi
LuaVIEW Pull (U8).vi LuaVIEW Push (I16).vi LuaVIEW Push (nil).vi
LuaVIEW Pull (boolean).vi LuaVIEW Push (I32).vi LuaVIEW Push (number).vi
LuaVIEW Pull (flat data).vi LuaVIEW Push (I8).vi LuaVIEW Push (object).vi

Function registration VIs

LuaVIEW Bootstrap.vi LuaVIEW Register Private Function.vi LuaVIEW Register and Set Indexed Function.vi
LuaVIEW Cleanup Public Registry.vi LuaVIEW Register Public Function Directory.vi LuaVIEW Register and Set Module Function.vi
LuaVIEW Register Private Function Directory.vi LuaVIEW Register Public Function.vi LuaVIEW Revoke Exports.vi

Advanced API VIs

LuaVIEW Cast Gen Ref to VI Ref.vi LuaVIEW Get Object Attribute.vi LuaVIEW Open Private State.vi LuaVIEW Set Object Attribute.vi re_LuaVIEW Incite.vi
LuaVIEW Cast VI Ref to Gen Ref.vi LuaVIEW Get Task Script Directory.vi LuaVIEW Poll Print Buffer.vi LuaVIEW Stack Elements.vi re_LuaVIEW Plug-in Handler.vi
LuaVIEW Clear Stack.vi LuaVIEW Get Task State Reference.vi LuaVIEW Push Value.vi LuaVIEW Stack to String.vi
LuaVIEW Get Current Line.vi LuaVIEW Open Base State.vi LuaVIEW Register Callback Event.vi re_LuaVIEW Execute Iteration.vi

API objects

obj_LuaVIEW Task List.vi re_obj_LuaVIEW Task State.vi

License status

LuaVIEW License Status.vi

LuaVIEW Pull (I16).vi

Retrieves an I16 data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (I16).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ii16

I16

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (I32).vi

Retrieves an I32 data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (I32).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ii32

I32

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (I8).vi

Retrieves an I8 data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (I8).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ii8

I8

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (U16).vi

Retrieves an U16 data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (U16).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

iu16

U16

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (U32).vi

Retrieves an U32 data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (U32).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

iu32

U32

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (U8).vi

Retrieves an U8 data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (U8).vi

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

cdlrn

LuaVIEW reference in

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

iu8

U8
Up to API index

LuaVIEW Pull (boolean).vi

Retrieves a boolean data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (boolean).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ibool

boolean

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (flat data).vi

Retrieves the item at the head/bottom of the Lua stack, translates it to a flat LabVIEW data string, and removes the item from the stack, thereby shifting any remaining data items down by one. The most important use for this VI is to transfer compound data from Lua (a table) to LabVIEW (a cluster or array). To perform the translation, this function requires the type descriptor of the LabVIEW type/cluster/array that specifies how the translation is to take place. To use the flat data on the LabVIEW side, unflatten it.

The translation is recursive and thus handles nested clusters and arrays. If no translation is possible, e.g. because a LabVIEW array type is specified but no Lua table is provided, an error is returned. The LuaVIEW manual details which translations are supported.

When the optional default flat data input is wired, its content will be used when either the Lua stack is empty or the Lua data item is nil. Note that allowing an empty stack is somewhat different from the other pull variants. It simplifies the implementation of an optional argument at the end of the argument list such that its omission causes the setting of default data.

When default data is wired and the Lua data item has missing/nil table elements that map into a cluster element that is not inside an array, a partial substition of only these elements is performed so that the Lua-side data need not be fully specified. This is like a bundle by name where some cluster elements are not specified and the default data serves the role of the input cluster.

This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (flat data).vi

cstr

default flat data

When it is allowed for the Lua data to be optional, nil, or incomplete, wire this input to provide default values to substitute for the missing data.

c1di16

type descriptor

Type descriptor corresponding to the <b>flat data</b> output as well as the optional <b>default flat data</b> input. The Lua data item being pulled is translated into this type. The descriptor can be obtained from "Flatten To String", "Variant To Flattened String", or the "Type Descriptor" control/indictor property.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

flat data

The translated Lua data item, optionally with default data filled in. To make the data usable, convert it using "Unflatten From String" or "Flattened String To Variant".

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (number).vi

Retrieves a number data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (number).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idbl

number

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (object).vi

Retrieves an object data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. The returned value is a generic refnum that identifies some LabVIEW side object and must be cast to the appropriate type before use. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (object).vi

cbool

kill (false)

Kill the object being retrieved. Wire true when the object has an associated LabVIEW resource and you are about to release that resource. Any subsequent attempt to pull the object with kill=false will result in a "dead object" error. This prevents the object from being used after your resource releasing function completes.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ibool

already dead?

Set when the kill input was wired with true but the object turned out to be dead already. This implies that a superfluous attempt is being made at releasing the resource associated with the object. This situation does not cause an error. It should be handled by doing nothing with the object. This allows the script writer to both set a cleanup function to release the object as well as release the object once done with it during script execution, without the need to disable the actions of the cleanup function. It is advisable to document this behaviour.

ignrn

object refnum

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (path).vi

Returns the path converted from a string at the head/bottom of the Lua stack. The string is subsequently removed, thereby shifting any remaining data items down by one. Beware that, if so configured, the string to path conversion might treat path seperators in a manner that differs slightly from LabVIEW's string to path conversion. Please refer to the manual appendix describing the various supported data types for details. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (path).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ipath

path

Path converted from the pulled Lua string.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (refnum).vi

Retrieves a refnum data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. The returned value is a generic refnum that identifies some LabVIEW side object and must be cast to the appropriate type before use. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (refnum).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ignrn

refnum

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (string).vi

Retrieves a string data item from the head/bottom of the Lua stack and removes it, thereby shifting any remaining data items down by one. This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Pull (string).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

string

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (I16).vi

Pushes an I16 data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (I16).vi

ci16

I16

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (I32).vi

Pushes an I32 data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (I32).vi

ci32

I32

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (I8).vi

Pushes an I8 data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (I8).vi

ci8

I8

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (U16).vi

Pushes an U16 data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (U16).vi

cu16

U16

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (U32).vi

Pushes an U32 data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (U32).vi

cu32

U32

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (U8).vi

Pushes an U8 data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (U8).vi

cu8

U8

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (boolean).vi

Pushes a boolean data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (boolean).vi

cbool

boolean

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (flat data).vi

Pushes a Lua-data item onto the stack after translating it from flat LabVIEW data. The most important use for this VI is to transfer compound data from LabVIEW (a cluster or array) to Lua (a table). To perform the translation, this function requires the type descriptor of the LabVIEW type/cluster/array that specifies how the translation is to take place. The translation is recursive and thus handles nested clusters and arrays. If no translation is possible, e.g. because cluster elements are not named, an error is returned. The LuaVIEW manual details which translations are supported. This VI is part of a polymorphic set that supports pushing various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu.

LuaVIEW Push (flat data).vi

cstr

flat data

The flattened LabVIEW data to translate into Lua-side data. It should match the provided type descriptor.

c1di16

type descriptor

Type descriptor corresponding to the flat data input. The flat data being pushed is translated into a Lua-side data item compatible with this type. The descriptor can be obtained from "Flatten To String", "Variant To Flattened String", or the "Type Descriptor" control/indictor property.

cdlrn

LuaVIEW reference in

cbool

include cluster order (false)

When set to true, any tables pushed for clusters in the flat data will be given an additional entry named "_cluster_order" containing an array-like table with the cluster element names ordered as per the cluster order. This can be used to iterate over the cluster's table in the same order as the order of the cluster elements. For example:

for i,k in ipairs(tab._cluster_order) do print(tab[k]) end

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (nil).vi

Pushes a nil data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (nil).vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (number).vi

Pushes a number data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (number).vi

cdbl

number

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (object).vi

Pushes a LuaVIEW object onto the Lua stack. To Lua it will appear as heavy userdata. This can be used to pass any refnum or other identifier specifying some LabVIEW-side object while attaching a set of methods that can be called, by Lua, on that object. The only requirement is that it can be cast into a generic refnum. Once the object is on the stack, any additional attributes can be attached using the "Set Object Attribute" VI. This VI is part of a polymorphic set that supports pushing various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (object).vi

cgnrn

object refnum

Cast the LabVIEW thingy you want to create a LuaVIEW object for to a generic refnum before passing it in here.

cstr

method table (use caller's function table)

A LuaVIEW object is more than just a refnum. It allows attachment of a set of methods, and, at a later stage, attributes. The methods can be attached by specifying the name of a table containing methods that operate on the type of object you are pushing. When unwired, the calling VI is assumed to be a LuaVIEW function with a VI name that includes both a function table and function name part. The table is assumed to contain methods that can operate on the object being pushed apart from the calling function itself as it returns an object instead of operates on an object.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (path).vi

Converts a path into a string and pushes that string onto the Lua stack. The conversion performed is identical to LabVIEW's "Path to String" conversion function. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (path).vi

cpath

path

Path to convert into the Lua string to push.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (refnum).vi

Pushes a refnum data item onto the Lua stack. To Lua it will appear as light userdata. This can be used to pass any refnum or other identifier specifying some LabVIEW-side object. The only requirement is that it can be cast into a generic refnum. This VI is part of a polymorphic set that supports pushing various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (refnum).vi

cgnrn

refnum

Cast the LabVIEW thingy you want to create a light userdata for to a generic refnum before passing it in here.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push (string).vi

Pushes a string data item onto the Lua stack. This VI is part of a polymorphic set that supports various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu. When "automatic" is checked in that menu, wiring a different type to the top left input will cause the appropriate VI to be selected automatically.

LuaVIEW Push (string).vi

cstr

string

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Pull (flat data).vi

Retrieves the item at the head/bottom of the Lua stack, translates it to a flat LabVIEW data string, and removes the item from the stack, thereby shifting any remaining data items down by one. Use this reentrant variant instead of the non-reentrant variant when pulling lots of flat data to prevent the non-reentrant VI from becoming contended. The most important use for this VI is to transfer compound data from Lua (a table) to LabVIEW (a cluster or array). To perform the translation, this function requires the type descriptor of the LabVIEW type/cluster/array that specifies how the translation is to take place. To use the flat data on the LabVIEW side, unflatten it.

The translation is recursive and thus handles nested clusters and arrays. If no translation is possible, e.g. because a LabVIEW array type is specified but no Lua table is provided, an error is returned. The LuaVIEW manual details which translations are supported.

When the optional default flat data input is wired, its content will be used when either the Lua stack is empty or the Lua data item is nil. Note that allowing an empty stack is somewhat different from the other pull variants. It simplifies the implementation of an optional argument at the end of the argument list such that its omission causes the setting of default data.

When default data is wired and the Lua data item has missing/nil table elements that map into a cluster element that is not inside an array, a partial substition of only these elements is performed so that the Lua-side data need not be fully specified. This is like a bundle by name where some cluster elements are not specified and the default data serves the role of the input cluster.

This VI is part of a polymorphic set that supports the pulling various data types. To change the type being pulled, pop up on this VI's diagram icon and use the "Select Type" sub menu.

re_LuaVIEW Pull (flat data).vi

cstr

default flat data

When it is allowed for the Lua data to be optional, nil, or incomplete, wire this input to provide default values to substitute for the missing data.

c1di16

type descriptor

Type descriptor corresponding to the <b>flat data</b> output as well as the optional <b>default flat data</b> input. The Lua data item being pulled is translated into this type. The descriptor can be obtained from "Flatten To String", "Variant To Flattened String", or the "Type Descriptor" control/indictor property.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

flat data

The translated Lua data item, optionally with default data filled in. To make the data usable, convert it using "Unflatten From String" or "Flattened String To Variant".

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Push (flat data).vi

Pushes a Lua-data item onto the stack after translating it from flat LabVIEW data. Use this reentrant VI instead of the non-reentrant variant when pushing lots of flat data to prevent the non-reentrant VI from becoming contended. The most important use for this VI is to transfer compound data from LabVIEW (a cluster or array) to Lua (a table). To perform the translation, this function requires the type descriptor of the LabVIEW type/cluster/array that specifies how the translation is to take place. The translation is recursive and thus handles nested clusters and arrays. If no translation is possible, e.g. because cluster elements are not named, an error is returned. The Lua for LabVIEW manual details which translations are supported. This VI is part of a polymorphic set that supports pushing various data types. To change the type being pushed, pop up on this VI's diagram icon and use the "Select Type" sub menu.

re_LuaVIEW Push (flat data).vi

cstr

flat data

The flattened LabVIEW data to translate into Lua-side data. It should match the provided type descriptor.

c1di16

type descriptor

Type descriptor corresponding to the flat data input. The flat data being pushed is translated into a Lua-side data item compatible with this type. The descriptor can be obtained from "Flatten To String", "VariantTo Flattened String", or the "Type Descriptor" control/indictor property.

cdlrn

LuaVIEW reference in

cbool

include cluster order (false)

When set to true, any tables pushed for clusters in the flat data will be given an additional entry named "_cluster_order" containing an array-like table with the cluster element names ordered as per the cluster order. This can be used to iterate over the cluster's table in the same order as the order of the cluster elements. For example:

for i,k in ipairs(tab._cluster_order) do print(tab[k]) end

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Close.vi

Closes a Lua for LabVIEW reference as returned by "LuaVIEW Open". This closes the Lua state associated with the references and decrements the function registry usage count. When the usage count reaches zero, the function registry is cleaned up.

This function executes irrespective of the input error so that the reference is closed and registry use count is decremented even when one of the preceeding chained VIs failed. It does not execute when a default (nil) reference is provided, as returned by a failed "LuaVIEW Open" or an uninitialized shift register. Do not close or otherwise use an already closed reference. Though Lua for LabVIEW performs checks to avoid operating on closed states, this is only 99.999% safe.

LuaVIEW Close.vi

cdlrn

LuaVIEW reference

When this is a default reference (as returned when the "LuaVIEW Open" has failed) the VI will do nothing.

ccclst

error in (no error)

An input error does NOT prevent this VI from executing.

cbool

cleanup public registry (F)

When set to true, and this is the last LuaVIEW state that uses the public registry, the function VIs in the public registry are immediately unloaded.

The public function registry and the corresponding VI references are managed by the VI reference daemon. When this boolean is set to false and the according global configuration is also set to fasle, the registry is retained (and the functions remain loaded) until the daemon is requested to clean up through LuaVIEW Cleanup Public Registry.vi, or LabVIEW exits. Keeping the functions loaded is convenient when testing during development since it will prevent the continual loading and unloading of a potentially large number of function VIs.

icclst

dup error

Duplicate of error in.

Up to API index

LuaVIEW Compile.vi

Compiles the provided script string so that it can be executed. This is not compilation to native machine code but rather compilation to bytecode that can execute on the Lua virtual machine instance associated with the provided Lua for LabVIEW reference. Multiple scripts can be compiled. These will be executed in order of compilation.

LuaVIEW Compile.vi

cstr

script name

This name shows up in the error report when a runtime error occurs in the provided script. Choose it such that the error report becomes more intelligible, e.g. the name of the file containing the script.

cdlrn

LuaVIEW reference in

cstr

script

Lua script to compile.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Open.vi

Open a Lua for LabVIEW state that can call public and export functions as well as the other types of Lua for LabVIEW function. The resulting state (passed via the Lua for LabVIEW reference) is ready for script compilation and subsequent execution. Once the Lua for LabVIEW reference is no longer required, close it using LuaVIEW Close.vi to free the associated resources.

When the public function registry is not yet initialized and the "auto-init registry" global is set, the registry will be initialized first with all Lua for LabVIEW function VIs in the built executable or, when running under development mode, with all Lua for LabVIEW function VIs in the functions directory of the Lua for LabVIEW toolkit.

Note that the Lua for LabVIEW reference returned by this VI is associated with a new and unique Lua state which entails an instance of the Lua virtual machine as well as the data space involved in compiling scripts and executing the resulting bytecode on that virtual machine instance. Scripts that run on different Lua states therefore have separate variable spaces.

LuaVIEW Open.vi

cbool

autoreset (F)

Set this to true to allow LabVIEW to dispose this state automatically as soon as the VI hierarchy that called this Open function goes idle.

This can cause problems if your application calls the Open function from a different top level VI hierarchy than where the state is used, and that top level hierarchy ends execution before the last use of the state in another hierarchy.

However it is not meant to replace proper resource management through explicit calls to the according Close function.

cbool

autoregister (T)

Set this to false to prevent the registration of the public Lua for LabVIEW functions in the luaview/functions directory.

Note: In the RT targets this is always disabled since there are no such functions available without explicitly deploying them as source code distribution to a directory on the target. In that case your application should itself take care to register all the functions that were deployed, as public or private functions.

ci32

yield count (50) (optional)

Sets the opcode yield count for the new Lua state.

This value determines after how many opcodes the Lua virtual machine should yield, in order to pass control back to LabVIEW. The default of 50 should only be lowered for special circumstances such as when implementing some sort of debugging in the Lua script itself. For normal operation lowering this will cause significant slowdown of the Lua code execution.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference

When the open fails, a null reference is returned. This can be safely passed into LuaVIEW Close.vi which, when null, does nothing.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Pull (poly).vi

Pull a data item of a polymorphic type from the Lua stack. This can be an argument in case of a Lua to LabVIEW call, or a result in case of a LabVIEW to Lua call. The data item is retrieved from the head/bottom of the stack and removed, thereby shifting any remaining data items down by one.

LuaVIEW Pull (poly).vi

Up to API index

LuaVIEW Push (poly).vi

Push a data item of a polymorphic type onto the Lua stack. This can be a result in case of a Lua to LabVIEW call, or an argument in case of a LabVIEW to Lua call. The data item is placed on the top of the stack.

LuaVIEW Push (poly).vi

Up to API index

LuaVIEW Swap Task.vi

Swap the script(s) executing under an existing Lua for LabVIEW task. This VI loads, pre-processes, and compiles the new script(s), and signals the task to be swapped to execute the new script(s). This VI does not wait for the task to commence with swapping: any run-time error that occurs on cleaning up the prior script(s) or on executing the new script(s) is not returned by this VI.

LuaVIEW Swap Task.vi

cpath

script file or name (no name)

Path/file holding the task script. If relative, any custom and script search directories will be examined. When a script string is provided, the name part of this path (if provided) will be used as a name for the script while reporting errors, but it will not be used for file I/O purposes.

cpath

custom search directory (none)

cstr

script string ("" == load from file)

When wired with a non-empty string, this will be used as the task script (as opposed to loading the script from a file).

cstr

identifier (use keyword)

The identifier of the task to swap scripts for. When left unwired or empty, an attempt is made to extract the identifier from the provided script via the --#identifier preprocessor keyword.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

identifier

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Call.vi

Call a Lua-side function. Any elements pushed onto the stack prior to the call are passed as arguments. When the function returns, the stack holds the function result values, if any. The call is protected so that any errors during the function's execution are caught.

Never make simultaneous calls to the same Lua for LabVIEW state.

To be able to make Lua-side calls, open a Lua for LabVIEW base state using "Open Base State" and compile one or more scripts implementing the function or functions to be called using "Compile". Next, the resulting compilations must be executed using "Execute" so that the functions become defined. After that, "Call" can be used on all defined functions. Functions called via "Call" cannot call LabVIEW-side functions and are not interruptable other than through throwing an error.

re_LuaVIEW Call.vi

cstr

function name

Name of the function to call with optional table prefixes. To prefix one or more tables, use the '.' separator. Some examples: "foo" specifies a function assigned to global "foo"; "foo.bar" specifies a function with key "bar" contained in a table referenced by global "foo"; "foo.bar.baz" specifies a function with key "baz" contained in a table with key "bar" contained in a table referenced by global "foo"; and so on.

cdlrn

LuaVIEW reference in

ci32

required results (no checking needed)

When you cannot assume that the function being called returns a particular number of results (e.g. because it is defined in an external script that is modifyable by others), yet a particular number of results is required, wire that number to this input. This will cause a descriptive error to be thrown when the called function returns fewer or more results.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Do Script.vi

Compiles and executes a script while also opening and closing the Lua for LabVIEW reference (which creates and destroys a virtual machine instance) required for this purpose. Use the primitives instead of this VI when manipulation of the script execution state is required.

re_LuaVIEW Do Script.vi

cpath

script file or name (no name)

Path/file holding the task script. If relative, any custom and script search directories will be examined. When a script string is provided, the name part of this path (if provided) will be used as a name for the script while reporting errors, but it will not be used for file IO purposes.

cpath

custom search directory (none)

cstr

script string ("" == load from file)

When wired with a non-empty string, this will be used as the task script (as opposed to loading the script from a file).

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Do Task.vi

Do a Lua for LabVIEW task. This prepares a task, runs it, and waits until the task is done before returning. Any error thrown during the task's execution is returned.

re_LuaVIEW Do Task.vi

cpath

script file or name (no name)

Path/file holding the task script. If relative, any custom and script search directories will be examined. When a script string is provided, the name part of this path (if provided) will be used as a name for the script while reporting errors, but it will not be used for file IO purposes.

cpath

custom search directory (none)

cstr

script string ("" == load from file)

When wired with a non-empty string, this will be used as the task script (as opposed to loading the script from a file).

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Execute.vi

Execute one or more previously compiled scripts until the last script completes or an error occurs and any cleanup handling has run its course. This simple iterator does not do run-time script management such as probing as tasks do. Neither does this VI allow for indexed functions to be called. To do that a custom iterator must be implemented.

re_LuaVIEW Execute.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Run Task.vi

Runs a new Lua for LabVIEW task. This prepares a task and runs it. This VI returns when the task has progressed beyond its initialization. When the task fails while initializing, its error is returned.

re_LuaVIEW Run Task.vi

cpath

script file or name (no name)

Path/file holding the task script. If relative, any custom and script search directories will be examined. When a script string is provided, the name part of this path (if provided) will be used as a name for the script while reporting errors, but it will not be used for file I/O purposes.

cpath

custom search directory (none)

cstr

script string ("" == load from file)

When wired with a non-empty string, this will be used as the task script (as opposed to loading the script from a file).

cbool

manual? (false)

When set, initialization errors are not returned and the task is left listed in error mode. This can be used when manually launching the task from the "Task Manager" or similar. The idea is that the user is present and should be enabled to do a post-mortem analysis on the task.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ibool

manual error

When the task was run with the "manual?" input set to true, and an initialisation error occurs after the task has become listed, no error cluster is returned even though the task is in error mode. Instead, this output is set to true. It should be used to trigger a post-mortem analysis on the task, which is left listed to allow such.

istr

identifier

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Bootstrap.vi

Bootstrap an application that uses Lua for LabVIEW with a Lua script. Note that this VI is intentionally non-reentrant so that only a single bootstrap script can be active at any one time. The bootstrap script can set the global configuration and register functions prior to starting further Lua scripts. To do so, the bootstrap script has access to all C functions and a small set of Lua for LabVIEW functions:

configure(tab:configuration)

str:path=bootstrap_path()

str:path=toolkit_path(str:toolkit,[str:subpath])

str:kind=app_kind()

register.public(str:path)

register.public_dir(str:dirpath)

do_script(str:name,[str:script])

The last four are identical to the standard Lua for LabVIEW functions of the same name. The configure() function is used to set the configuration globals. See the bootstrapping example VI for details. When the bootstrap script was loaded from a file instead of passed as a string, the bootstrap_path() function returns a path to the directory containing the script. This allows the resource base path or script search directories to be configured relative to this path.

Though bootstrapping can also be done with LabVIEW code that sets configuration globals and calls the LabVIEW API to register functions, the advantages of a bootstrap script are that it has convenient error handling and can be changed when deployed with a built executable.

LuaVIEW Bootstrap.vi

cpath

script file or name (no name)

Path/file holding the bootstrap script. If relative, any custom and script search directories will be examined (though the search directories will typically not be configured before the bootstrap has run). When a script string is provided, the name part of this path (if provided) will be used as a name for the script while reporting errors, but it will not be used for file IO purposes.

cpath

custom search directory (none)

cstr

script string ("" == load from file)

When wired with a non-empty string, this will be used as the bootstrap script (as opposed to loading the script from a file).

c1dsvrn

task alternatives (default)

References to the various task VIs that each represent an allowed choice for the combination of preferred execution system and execution priority. When the --#prefsys and --#priority preprocessor keywords are used to configure a task, a task VI reference with that combination must be present in this array so that an instance of that VI can serve as the top-level context under which the task executes. When either or both keywords are omitted in a task script, the execution system and/or priority of the first entry in the array is used as the default choice. When this array is left unwired, tasks can only be started under the standard execution system at normal priority.

This array can be initialized using references obtained via "Open VI Reference". However it is more convenient to use static references since this will cause the task VIs to automatically be included in a build.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Cleanup Public Registry.vi

Requests a cleanup of the public Lua for LabVIEW function registry. This will cause the public function VIs as well as the registry daemon to be unloaded. Use of this VI is not necessary when the "Unload Functions ASAP" global is set. If the registry is not initialized, this function will return immediately. If the registry is still in use (there are running scripts that use public functions), this VI will fail. If the registry was initialized but no longer in use, this VI will return after unloading completes. Do not simultaneously register and cleanup.

LuaVIEW Cleanup Public Registry.vi

icclst

error out

Any error that occurred while trying to clean up the registry. If any error is returned, it will typically be due to open Lua for LabVIEW states that make use of the registry so that cleanup cannot commence.

Up to API index

LuaVIEW Register Private Function Directory.vi

Tries to register all VIs ending in "_lua.vi" in a directory or llb and, recursively, in any subdirectories or llbs, or, alternatively, inside a built executable as private Lua for LabVIEW functions with the provided Lua for LabVIEW state.

LuaVIEW Register Private Function Directory.vi

cdlrn

LuaVIEW reference in

cpath

base path

Directory/llb/exe where the function VIs or subdirectories with function VIs reside. When a relative path is specified, the resource base path is prepended.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Register Private Function.vi

Open a reference to a Lua for LabVIEW function VI and add it to the Lua for LabVIEW state's private registry so that any script running under that state can call the function.

LuaVIEW Register Private Function.vi

cdlrn

LuaVIEW reference in

cpath

function VI path

Path to the function VI. When relative, the resource base path is prepended.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Register Public Function Directory.vi

Tries to register all VIs ending in "_lua.vi" in a directory or llb and, recursively, in any subdirectories or llbs, or, alternatively, inside a built executable as public Lua for LabVIEW functions.

LuaVIEW Register Public Function Directory.vi

cpath

base path

Directory/llb/exe where the function VIs or subdirectories with function VIs reside. When a relative path is specified, the resource base path is prepended.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Register Public Function.vi

Open a reference to a Lua for LabVIEW function VI and add it to the public registry. Any Lua for LabVIEW states that are opened after the function was registered will be able to call the function (unless "Use Public Registry?" was reset to false on opening the state). If the function VI was already registered, no further resources will be allocated.

LuaVIEW Register Public Function.vi

cpath

function VI path

Path to the function VI. When relative, the resource base path is prepended.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Register and Set Indexed Function.vi

Registers an indexed function with the Lua for LabVIEW state's private function registry and sets the function as part of the state's variable space so that it can be called by name. Indexed functions are functions whose LabVIEW-side functionality is specified via an index instead of a function VI reference. When an indexed function is called, "LuaVIEW Execute Iteration" will return and leave the handling to its caller. Thus, indexed functions can be implemented as part of anything that allows selection via an index (typically a case of a case structure).

LuaVIEW Register and Set Indexed Function.vi

cdlrn

LuaVIEW reference in

ci32

index

Selection index of the indexed function. The index must be > 0. This allows 0 to be treated as a special case that selects script resumption.

cstr

synopsis

Calling synopsis of the function. This has as format:

[<type>:<name1> [,<type>:<name2> [,etc.]] = ] [<tablename>.]<functionname>

([<type>:<name1>[,<type>:<name2> [,etc.]])

for the result list, naming, and argument list.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Register and Set Module Function.vi

Registers a module function with the Lua for LabVIEW state's private function registry and sets the function as part of the state's variable space so that it can be called by name. When the function is to be exported, as denoted by an exclamation mark prefix to its synopsis, it is also registered with the public function registry. If an exported module function of that name and table is already present, it will be replaced. This implies that the module or module instance called via an exported module function can change while a script is running. Replace exports only when they offer equivalent functionality.

LuaVIEW Register and Set Module Function.vi

cgnrn

module refnum

cstr

export table (set as global)

cstr

table (set as global)

cdlrn

LuaVIEW reference in

ci32

index

Selection index of the indexed function. The index must be > 0. This allows 0 to be treated as a special case that selects script resumption.

cstr

synopsis

Calling synopsis of the function. This has as format:

[<type>:<name1> [,<type>:<name2> [,etc.]] = ] [<tablename>.]<functionname>

([<type>:<name1>[,<type>:<name2> [,etc.]])

for the result list, naming, and argument list.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Revoke Exports.vi

Revokes the functions exported from a module or module instance. When your module performs cleanup actions after which calls to export functions result in erroneous or undefined results, and there is a risk that scripts that use the export functions are still active when your module cleans up, it is necessary to revoke the export functions before performing those cleanup actions. To do so, first call this VI from a dedicated module function, say "revoke_exports()". It is not fully safe to call this VI inside the cleanup function since an export call might be made in the short timespan between entering that function and revocation.

Note that if you want the scripts that use the export functions to switch over to using a subsequently initialized module instance without their ongoing calls being in risk of failing, the new module instance must be initialized within the (configurable) "export timeout" period after this VI is called. This VI only throws an error when it is NOT called as part of a non-export module function.

LuaVIEW Revoke Exports.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Cast Gen Ref to VI Ref.vi

This VI casts between incompatible refnum types. Refnums passed to Lua only carry their value and not their type. It is therefore required to cast them to a generic type on passing them to Lua and back from the generic type to their actual type on retrieval from Lua. Since LabVIEW does not allow this for safety reasons, code such as contained in this VI is required to trick the LabVIEW compiler.

LuaVIEW Cast Gen Ref to VI Ref.vi

cgnrn

refnum in

ivirn

refnum out
Up to API index

LuaVIEW Cast VI Ref to Gen Ref.vi

This VI casts between incompatible refnum types. Refnums passed to Lua only carry their value and not their type. It is therefore required to cast them to a generic type on passing them to Lua and back from the generic type to their actual type on retrieval from Lua. Since LabVIEW does not allow this for safety reasons, code such as contained in this VI is required to trick the LabVIEW compiler.

LuaVIEW Cast VI Ref to Gen Ref.vi

cvirn

refnum in

ignrn

refnum out
Up to API index

LuaVIEW Clear Stack.vi

Clears the stack. This can be used to remove any remaining arguments from the stack before starting to push results. This VI is rarely required since the argument pull VIs already remove their arguments from the stack. It might come in handy after performing an in-place operation on a stack argument.

LuaVIEW Clear Stack.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Register Callback Event.vi

This advanced function allows to register or unregister a debug callback event that can be registered with an event structure and will report the current line number in a script.

LuaVIEW Register Callback Event.vi

cenum

method

Determines if the callback is registered or not. Possible values:

unregister (0): unregister any line count callback

polling (1): register a line count callback but only provide the current line through the "LuaVIEW Get Current Line.vi" function.

user event (2): create a user event and register it for report of current line information.

user event with name (3): as user event (2) before but also report the name of the current module in the user event.

NOTE: registering a debug callback will cost performance as for every new line in a Lua for LabVIEW script the Lua engine will call a callback routine that is optionally translated into a LabVIEW user event. And the reporting of the current module name will cost additional performance.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ignrc

LuaVIEW callback

The user event to register for and wire to an event structure for handling any line number events, if method was set to "user event (2)" or "user event with name (3)".

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.


LuaVIEW Callback Event Record.ctl

This is the data cluster that passes event information into the user event frame for handling the according event.

Controls and Indicators

ccclst

event

Up to API index

LuaVIEW Get Current Line.vi

This function retrieves the line number at which the script is currently. This only returns a valid number if the reporting of line numbers has previously been enabled through an according call to the LuaVIEW Register Callback Event.vi.

LuaVIEW Get Current Line.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

iu32

line

The line number at which the script is currently..

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Get Object Attribute.vi

Gets an attribute of a Lua for LabVIEW object. The object must be located at the bottom of the stack. The retrieved value is pushed onto the top of the stack for later pulling.

LuaVIEW Get Object Attribute.vi

cstr

key

Key of the attribute to set. Preferably use a valid Lua identifier so that the simplified <object>.<key> syntax can be used to access the attribute.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Get Task Script Directory.vi

Returns the directory holding the task script. When not a task, task script remote, or task script provided as a string, an empty path and error is returned.

LuaVIEW Get Task Script Directory.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ipath

task script directory

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Get Task State Reference.vi

Returns a reference to the task state object when the Lua for LabVIEW state is part of a task context. Otherwise an error is returned. This VI is used by Lua for LabVIEW functions that operate on the task state of the calling context.

LuaVIEW Get Task State Reference.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

isvrn

task state reference

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW License Status.vi

Query the state of the Lua for LabVIEW license on the local machine. This function allows an Lua for LabVIEW application to query the current license state of the Lua for LabVIEW library and to optionally display the license activation dialog.

LuaVIEW License Status.vi

cenum

mode (show dialog)

Determines if this function should display a dialog.

get status (0): only qeries the current status

dialog if not licensed (1): queries the status and if there is no valid license will show the license activation dialog and after the user dismisses the dialog, will return with the possibly new status.

show dialog (2): always show the dialog and fter the user dismisses the dialog, will return with the possibly new status.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ienum

type

The actual license status. Possible values are:

unlicensed (0): There was no valid license found.

full (1): A full development license is registered.

runtime (2): A runtime license is registered.

time limited (3):

ii32

remainingDays

The number of days the current license is valid when the license status is something else than unlicensed (0).

A positive value indicates the remaining days this license will be valid, a negative value of -1 indicates a license with no time limit.

ibool

is Evaluation

If the license status is anything but unlicensed (0), this indicates if the current license is an evaluation license. Normally evaluation licenses are time limited licenses.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Open Base State.vi

Opens a Lua for LabVIEW base state which is essentially an instance of the Lua virtual machine with associated storage, and returns a reference to it. A base state lacks the infrastructure and preparations required for calling LabVIEW from Lua. Instead it is intended for hosting functions to be called from LabVIEW via the "Call". To define callable functions, compile and execute a script containing function definitions for a base state.

Closing a base state is not required when it is only opened once during an application run: open base states are closed when the Lua for LabVIEW VIs unload. When repeatedly opening a state for the same purpose, the "close identifier" can be used to automatically close stale states.

LuaVIEW Open Base State.vi

cstr

close identifier (none)

Causes any still open base states with the same tracking identifier to be closed. By wiring an identifier that is unique to your VI, states dating from prior runs of your VI will first be closed so that no open states will accumulate. An easy way to provide such an identifier is to wire the name of your VI, provided that your VI is not reentrant.

cbool

autoreset (F)

Set this to true to allow LabVIEW to dispose this state automatically as soon as the VI hierarchy that called this Open function goes idle.

This can cause problems if your application calls the Open function from a different top level VI hierarchy than where the state is used, and that top level hierarchy ends execution before the last use of the state in another hierarchy.

However it is not meant to replace proper resource management through explicit calls to the according Close function.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference

Reference to the opened Lua for LabVIEW base state, or not a refnum in case of a failed open.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Open Private State.vi

Open a Lua for LabVIEW state that does not make use of the public function registry nor any module export functions. To use the returned state, register and set any private and indexed functions, compile a script, and execute it. Once the Lua for LabVIEW reference is no longer required, close it using "LuaVIEW Close" to free the associated resources.

Though anything that can be done with a state returned by this function can also be done with a state returned by "LuaVIEW Open", it is sometimes desirable to use this VI to prevent the loading of the infrastructure associated with the public function registry.

The opened Lua for LabVIEW state holds a new instance of the Lua virtual machine. Scripts that run on different Lua for LabVIEW states therefore have separate variable spaces.

LuaVIEW Open Private State.vi

cbool

autoreset (F)

Set this to true to allow LabVIEW to dispose this state automatically as soon as the VI hierarchy that called this Open function goes idle.

This can cause problems if your application calls the Open function from a different top level VI hierarchy than where the state is used, and that top level hierarchy ends execution before the last use of the state in another hierarchy.

However it is not meant to replace proper resource management through explicit calls to the according Close function.

ci32

yield count (50) (optional)

Sets the opcode yield count for the new Lua state.

This value determines after how many opcodes the Lua virtual machine should yield, in order to pass control back to LabVIEW. The default of 50 should only be lowered for special circumstances such as when implementing some sort of debugging in the Lua script itself. For normal operation lowering this will cause significant slowdown of the Lua code execution.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference

When the open fails, a null reference is returned. This can be safely passed into "LuaVIEW Close" which, when null, does nothing.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Poll Print Buffer.vi

Each Lua for LabVIEW state is provided with a private print buffer. Using the lv.print() function, text can be printed to this buffer on a per-script or per-task basis. This VI allows polling of the content of these print buffers for display purposes. One option is to empty the entire content, and display that. This limits the amount of displayed text to the size of the circular print buffer (32768 characters). Alternatively, the read index can be used to return only the newly printed text, if any. By frequently polling the buffer and appending the returned text to previously read text, you can display more text than fits inside the buffer.

This VI is exceptional because it is designed to poll the print buffer of a Lua for LabVIEW state while other operations on that state are ongoing: normally actions on the same Lua for LabVIEW state must be serialized. This implies that it can be used inside a loop that is asynchronous from the script or task execution.

LuaVIEW Poll Print Buffer.vi

cdlrn

LuaVIEW reference in

cbool

read all?

When set to true, the read index input is ignored and the entire print buffer content is returned. When set to false, the print buffer is read starting from the specified read index.

ci32

read index in

Index as of which to read the print buffer. Used when the "read all?" input is set to false. When the text at the specified index is no longer present in the buffer, the "text gap?" output will be set to true and as much data as possible will be returned.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

text

Text read from the print buffer.

idlrn

LuaVIEW reference out

ibool

text gap?

Set to true when the text requested via the read index input is no longer present in the print buffer. For typical use, this implies that there is a gap between previously read text, and the new text being returned. When displaying the text, you may wish to alert the user of the gap by displaying a special string, e.g. <<MISSING TEXT>>.

ii32

read index out

Indexes the print buffer beyond the last read character. Can be used on the next call to retrieve text continuous with the previously read text.

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Push Value.vi

Pushes the value located at the bottom (front) of the stack onto the top of the stack without removing it. This can be used to duplicate a stack element. A likely use is to duplicate a table or Lua for LabVIEW object (which Lua passes by reference) for later in-place modification.

LuaVIEW Push Value.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Set Object Attribute.vi

Sets an attribute on a Lua for LabVIEW object. When calling this VI, the value to set (any type) must be at the top of the stack and be preceded by the object on which to set the attribute. The value being set is removed from the stack. The function's documentation should list these attributes. Note that attributes are read-only on the Lua side. Object attributes can be read from in the very same way as table attributes.

Attributes can be used to adorn an object being returned by a Lua for LabVIEW function with invariant object properties. An alternative use is for an attribute to maintain some object-instance specific variable that changes between method calls, e.g. something like the read/write/seek offset associated with a file handle.

LuaVIEW Set Object Attribute.vi

cstr

key

Key of the attribute to set. Preferably use a valid Lua identifier so that the simplified <object>.<key> syntax can be used to access the attribute.

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Stack Elements.vi

Returns the number of elements on the stack. This is typically used to determine the number of arguments remaining on the stack in case of a function that accepts a variable number of arguments. Functions with a fixed number of arguments can simply assume those arguments to be present on calling, provided that their documentation/synopsis is in sync with their implementation, because automated argument checking ensures this.

LuaVIEW Stack Elements.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

ii32

elements

Number of elements present on the Lua stack.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

LuaVIEW Stack to String.vi

Removes the elements present on the stack and converts them into a space-separated string terminated by a linefeed that is suited for printing. This VI is used by print() and similar functions. When converting an element to a string, this function uses the "tostring" function, which respects "__tostring" metamethods. You can therefore customize the print formatting by overriding "tostring" or defining meta methods.

LuaVIEW Stack to String.vi

cdlrn

LuaVIEW reference in

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

string

Print string reflecting the elements that were present on the stack.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Execute Iteration.vi

Execute compiled script(s) for a single "resume" iteration and return to LabVIEW when the last script completes, a LabVIEW-side call is made, a yield is performed, an error occurs, and so on. Iterating over resumptions allows LabVIEW-side stuff to be interspersed with virtual machine execution. Any custom LabVIEW-side stuff, such as indexed functions or execution management must be implemented as part of the loop inside which this VI is called.

re_LuaVIEW Execute Iteration.vi

cdlrn

LuaVIEW reference in

ccclst

init or indexed function error

Any error on the first iteration of this state is supposed to result from initialization and is passed through. During later iterations, this input must be wired with any error caused by an indexed function that was called in the code surrounding this VI. This need not cause immediate script termination, e.g. in case of a protected call or cleanup functions.

ibool

last?

True when no further iterations are required.

idlrn

LuaVIEW reference out

ii32

function index

When > 0, a call to an indexed function was made and must be handled by this VI's caller. When no indexed functions are registered with the Lua for LabVIEW state, this will never occur. Typically, the index will be cast to an enum and wired to the selection terminal of a case structure. This allows a close mixing of Lua and LabVIEW code.

When a task is being executed, this output will be set to 1 when the main task script is about to be executed (on the next iteration). Otherwise it will be set to zero. Note that tasks do not call indexed functions.

icclst

final error

If an error has occurred on initialization or during execution, it will be output here on the last iteration.

Up to API index

re_LuaVIEW Incite.vi

Incite a task to send a reply. This is done by sending the task to be incited a message containing the task identifier of the current task. The incited task can then perform whatever service it is designed to provide and use that identifier to send a reply message when it is done. This VI returns on receiving the reply unless an error occurs.

An error occurs when the provided Lua for LabVIEW reference is not associated with a task (this VI is not called inside a task) or when the task being incited does not exist, is in error mode, or fails to reply before the timeout expires. BEWARE: the task doing the incitation should not be receiving other types of messages at the same time lest these get confused with the incitation reply.

Incitation provides an easy means of synchronously using a service provided by an asynchronous task. More complex message/reply mechanisms can be coded in similar fashion: this VI merely constitutes a convenience implementation of the instigating side of the simplest conceivable message/reply mechanism. Module export functions also allow a synchronous service to be offered and involve less overhead on account of not requiring a context switch. The advantage of a message/reply mechanism is that the service can be implemented as a task script that can also add asynchronous actions such as periodic updates into the mix.

re_LuaVIEW Incite.vi

cstr

task

Task to incite.

cu32

timeout [ms] (use default)

Number of milliseconds to wait for a reply before timing out. When not wired, the default timeout as specified in the "incite timeout" configuration global is used.

cdlrn

LuaVIEW reference in

The Lua for LabVIEW state of the task as part of which this VI is called.

ccclst

error in (no error)

When an error is passed in, this VI will return without executing its actions.

istr

reply

Reply message from the incited task.

idlrn

LuaVIEW reference out

icclst

error out

Returns the input error or any error that occurs on execution of this VI.

Up to API index

re_LuaVIEW Plug-in Handler.vi

This VI can be used inside a plug-in to assist in handling task signals. Examine the plugin template to see how it is deployed. The built-in handling of task signals does not work while called into a plug-in. Using this handler or similar code allows a plug-in to nevertheless respond to task signals. This handler limits itself to waiting for the timeout to expire when the plug-in was not started from a task.

re_LuaVIEW Plug-in Handler.vi

cdlrn

LuaVIEW reference

ci32

timeout (ms)

Number of millseconds that should pass without receipt of signals before the handler times out.

ienum

handle

Enum indicating if signal handling is to be done by the calling plug-in. When set to "timeout" no signals were received and the plugin can proceed as normal. When set to "stop" or "swap", the plug-in should return to the calling script. To prevent interruption of service it is sometimes desirable to forego cleanup actions in case of a "swap".

Up to API index

obj_LuaVIEW Task List.vi

Lists Lua for LabVIEW tasks and allows operations on tasks in the list. A particular task is specified through its identifier and manipulated through a reference to its state object.

This VI is only marginally part of the API: those methods that are in common use by function VIs can be deemed safe for use provided that typedefs are used so as to be forward compatible with extension of the method enum or typedef clusters (only use unbundle/bundle by name, and so on).

Beware that when using this VI to send a request or message, the receiving task's request occurrence, as returned by this VI, must be set. This unfortunate inconvenience was made mandatory to avoid the superfluous context switches that can occur when occurrences are set from within a non-reentrant object.

obj_LuaVIEW Task List.vi

cenum

method

cstr

message

csvrn

state object ref in

ci32

script index

cstr

task identifier

icclst

task info

i1dtdef

task info list

isvrn

state object ref out

ibool

set/ongoing

iocrn

wakeup occurrence

The wakeup occurrence of the specified task. Set this occurrence after setting a signal or sending a message. This causes the receiving task to be woken up. To allow the task to be scheduled immediately, follow setting the occurrence by a wait(1): a wait(0) does not necessarily cause a reschedule.

The occurrence is not set inside the task list to prevent the object from being blocked for use by the receiving task on account of a still ongoing call: such an eventuality would increase instead of lower response latency.

icclst

script info
Up to API index

re_obj_LuaVIEW Task State.vi

Instantiated per task. Holds the state of a task and allows for asynchronous communication with a task. Must be called by reference. A reference can be obtained from the task list.

This VI is only marginally part of the API: those methods that are in common use by function VIs can be deemed safe for use provided that typedefs are used so as to be forward compatible with extension of the method enum or typedef clusters (only use unbundle/bundle by name, and so on).

re_obj_LuaVIEW Task State.vi

cenum

method

cenum

mode {set mode}

cenum

signal

ci32

script index

cstr

string in

icclst

task info {get task info}

ibool

set/available/pending

icclst

script info

istr

string out

iocrn

wakeup occurrence