Wikia

CHDK Wiki

Lua/Lua Reference/Levent

Talk0
572pages on
this wiki

< Lua | Lua Reference

Revision as of 20:36, March 23, 2013 by Waterwingz (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Lua interface to LogicalEvent functionsEdit

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

get_levent_def(event)Edit

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)Edit

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)Edit

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])Edit

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)Edit

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)Edit

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

calls SetScriptMode(state)

Around Wikia's network

Random Wiki