Magic Lantern Firmware Wiki
Advertisement

Lua[]

A Lua enabled build can be found here: https://bitbucket.org/sztupy/magic-lantern/downloads

Specification of the lua support:

  • LUA: version 5.2.0 (from scripting view should be the same as 5.1.x)
  • Number format: signed 32 bit integer (that means no decimal values)
  • Built in libraries: all, except: math, io, os

Only tested on 60D & 600D!

Current API:[]

cprint(s)[]

writes string 's' to the console

bmpprint(x,y,s)[]

writes string 's' to the coordinates 'x','y'

openlibs()[]

loads the standard lua libraries into memory, except io, math and os.

msleep(n)[]

sleeps 'n' milliseconds

res = getconfig(cname)[]

gets the value of the config called 'cname', and puts into 'res'. Returns nil if the variable is not found

res = setconfig(cname, nval)[]

sets the value of the config called 'cname' to 'nval' returns true if success, false othervise

tbl = configs()[]

gets a table of all config variables in the system

ret = getprop(id)[]

gets the value of property 'id'. If the property has a size of 4 it will be an int else it will be a string. nil is returned in case of an error

ret = getintprop(id)[]

gets the value of property 'id'. This function will always return an int, or nil in case of an error.

ret = getstrprop(id)[]

gets the value of property 'id'. This function will always return a string, or nil in case of an error.

setprop(id,value)[]

Sets the value of property 'id' to 'value'.

shoot(wait, allow_af)[]

Takes a picture.

eoscall(name)[]

Runs EOS subroutine called 'name'.

Example[]

PROP_WB_KELVIN_LV = 0x80050019
PROP_WB_MODE_PH = 0x8000000D
PROP_WB_KELVIN_PH = 0x8000000E

setprop(PROP_WB_MODE_LV,9);
setprop(PROP_WB_MODE_PH,9);

setwb = function(wb)
  setprop(PROP_WB_KELVIN_LV, wb);
  setprop(PROP_WB_KELVIN_PH, wb);
end

for wb = 3000, 6000, 200 do
  setwb(wb)
  cprint("Shooting at "..wb.."K\n")
  shoot(64, false)
  msleep(1000)
end

Old[]

Previous scripting was: MagicLUA

Advertisement