Lua[edit | edit source]

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:[edit | edit source]

cprint(s)[edit | edit source]

writes string 's' to the console

bmpprint(x,y,s)[edit | edit source]

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

openlibs()[edit | edit source]

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

msleep(n)[edit | edit source]

sleeps 'n' milliseconds

res = getconfig(cname)[edit | edit source]

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

res = setconfig(cname, nval)[edit | edit source]

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

tbl = configs()[edit | edit source]

gets a table of all config variables in the system

ret = getprop(id)[edit | edit source]

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)[edit | edit source]

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

ret = getstrprop(id)[edit | edit source]

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

setprop(id,value)[edit | edit source]

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

shoot(wait, allow_af)[edit | edit source]

Takes a picture.

eoscall(name)[edit | edit source]

Runs EOS subroutine called 'name'.

Example[edit | edit source]

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[edit | edit source]

Previous scripting was: MagicLUA

Community content is available under CC-BY-SA unless otherwise noted.