Luup Declarations
From MiOS
Revision as of 19:43, 12 June 2009 by Micasaverde (Talk | contribs)
When the Luup engine calls your Lua code it will pass your code some variables relevant to whatever the code is supposed to do. You can see how your code looks with the full function declarations by bringing up this page in a web browser: http://ip_of_vera:49451/data_request?id=lu_lua&DeviceNum=8
Here is a list of the variables that are passed to your Lua code, and also a list of what return values the Lua code should send back:
run
variables: lul_device is a number that is the device id. lul_settings is a table with all the arguments to the action.
return value: true or false where true means the function ran ok, false means it failed.
Sample, including the function/end lines which the Luup engine adds automatically:
function SetTarget_run(lul_device,lul_settings) lu_log('device: ' .. tostring(lul_device) .. ' value: ' .. tostring(lul_settings.newTargetValue)) return false end