nzLua code library examples

nzLua provides a way to create reusable nzLua code libraries. An nzLua code library uses a .nzll filename extension rather than the standard .nzl extension. The code can then be dynamically loaded by a UDX by using the require function at the beginning of the nzLua program.

Example #1

This example defines the library. The file must be named testlib.nzll to function correctly with the second example, which utilizes this library.
function testcalc(x,y,z)
return (x+y) * z

end

Example #2

This example uses the testcalc function that was defined in the first example.
require "testlib"

function evaluate(a,b,c)
return testcalc(a,b,c)
endfunction getName()
return "libtest"

end

function getType()
return "udf"

end

function getArgs()
args={}
args[1] = { "a", double }
args[2] = { "b", double }
args[3] = { "c", double }
return args

end

function getResult()
return double

end