For anyone wondering, I've found the way to get data into and out of LUA using the User and Global Variables like you could do on MA2.
A word of warning, this is me digging around without documentation so take that for what it's worth, and MA is likely not supporting this yet so it could change.
There are 5 functions (actually 7) in LUA that are used to get and set variables in the desk, they are:
GlobalVars() returns varsObject with Global Variables
UserVars() returns varsObject with User Variables
SetVar(varsObject:vars, string:name, var:value) returns bool:Success
DelVar(varsObject:vars, string:name) returns bool:Success
GetVar(varsObject:vars, string:name) returns var:value
So here is an example:
Code
-- grab variables Objects
local userVars = UserVars()
local globalVars = GlobalVars()
-- set values and save success
local userSuccess = SetVar(userVars, "User", 1000) -- GetUserVal "User" now contains Interger 1000
local globalSuccess = SetVar(globalVars, "Global", "2000") -- GetGlobalVal "Global" now contains Text 2000
-- if userSuccess then return the type of value of the variable
if userSuccess == true then
local userValue = GetVar(userVars, "User")
Printf("User Return Type = " .. type(userValue))
Printf("User Return Value = " .. userValue)
else
Printf("Failed to save user value")
end
-- if globalSuccess then return the type of value of the variable
if globalSuccess == true then
local globalValue = GetVar(globalVars, "Global")
Printf("Global Return Type = " .. type(globalValue))
Printf("Global Return Value = " .. globalValue)
else
Printf("Failed to save global value")
end
-- delete variables
globalSuccess = DelVar(globalVars, "Global")
userSuccess = DelVar(userVars, "User")
if globalSuccess == true then
Printf("Success deleting Global Variable")
else
Printf("Failed to delete Global Variable")
end
if userSuccess == true then
Printf("Success deleting User Variable")
else
Printf("Failed to delete User Variable")
end
if DelVar(userVars, "NOTHING") == true then
Printf("Success deleting Non Existing Variable")
else
Printf("Failed to delete Non Existing Variable")
end
-- Prints on the console
--
-- User Return Type = number
-- User Return Value = 1000
-- Global Return Type = string
-- Global Return Value = 2000
-- Success deleting Global Variable
-- Success deleting User Variable
-- Failed to delete Non Existing Variable
Display More