CHDK Wiki
m (moved Lua/LUA Reference/Levent to Lua/Lua Reference/Levent: Lua is not an acronym and should be proper case, not all caps)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
==Lua interface to [[LogicalEvent]] functions==
 
==Lua interface to [[LogicalEvent]] functions==
These functions are only implemented in Lua, not ubasic.
+
Note : these functions are only implemented in Lua, not uBASIC.
   
 
===get_levent_def(event)===
 
===get_levent_def(event)===
Line 45: Line 45:
   
 
calls SetScriptMode(state)
 
calls SetScriptMode(state)
[[Category:LUA]]
 
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Lua]]

Latest revision as of 20:36, 23 March 2013

Lua interface to LogicalEvent functions

Note : these functions are only implemented in Lua, not uBASIC.

get_levent_def(event)

event is an event id number or string name

returns three values (name, id, param) if index is valid, otherwise nil

  • name string name of the event, possibly the empty string.
  • id event id number
  • param third value in event table

get_levent_index(event)

event is an event id number or string name

returns the index of the given event, or nil if none match.

get_levent_def_by_index(index)

index is a zero based a index into the event table

returns three values (name, id, param) if index is valid, otherwise nil

  • name string name of the event, possibly the empty string.
  • id event id number
  • param if index is valid, otherwise nil

useful for iterating over event table

post_levent_*(event,[unk])

post_levent_to_ui and post_levent_for_npt

These call PostLogicalEventToUI or PostLogicaEventForNotPowerType respectively. This triggers the event, the difference between functions isn't clear.

event is an event id or name (NOT index)

unk is an optional number whose meaning is unknown, defaults to zero. For jog dial events, this must is the number of "clicks". This is NOT the 3rd item in the event table

set_levent_active(event,state)

event is an event id or name (NOT index)

state is a numeric or boolean state. true or non zero numbers turn on zero, false or nil turn off

calls SetLogicalEventActive(id,state)

set_levent_script_mode(state)

state is numeric or boolean state. true or non zero numbers turn on zero, false or nil turn off

calls SetScriptMode(state)