Call Us at 888-550-8728

Does USAT Corp have samples of AAF code?

Below is a classic “Hello World” style example.  If you are interested in more in-depth examples, please contact us.
— Documentation that starts with — is interpreted as luadoc
— It provides information that can be used by the IDE
local log = require(‘log’)
log.setlevel(“INFO”, “HELLO”)
— Creation of a new table that will contain the module
— Module that provide helper functions.
— @module my_module
local lib = {}
— Creation of a new field (hello) in the table
— This field is fill with a new function
— Function that prints and log hello message
— @function [parent=#my_module] hello
— @param #string name The name that will be in the message
— @return nothing
function lib.hello(name)
   print(‘Hello ‘..name..’!’)
   log.trace(“HELLO”, “INFO”, “\”Hello %s!\”, printed”, name)
end
— Creation of a field with a String value
— Default value for the message
— @field [parent=#my_module] #string default
lib.default = “World”
— creation of another function
— Default function to print hello world
— @function [parent=#my_module] helloworld
— @return nothing
function lib.helloworld()
   lib.hello(lib.default)
end
— Return of the table that will be used as a module
return lib

Category: General M2M Question

← FAQs