Wikia

Magic Lantern Firmware Wiki

Lua

328pages on
this wiki
Talk0

Lua Edit

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

cprint(s) Edit

writes string 's' to the console

bmpprint(x,y,s) Edit

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

openlibs() Edit

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

msleep(n) Edit

sleeps 'n' milliseconds

res = getconfig(cname) Edit

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

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

tbl = configs() Edit

gets a table of all config variables in the system

ret = getprop(id) Edit

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

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

ret = getstrprop(id) Edit

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

setprop(id,value) Edit

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

shoot(wait, allow_af) Edit

Takes a picture.

eoscall(name) Edit

Runs EOS subroutine called 'name'.

Example Edit

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

Previous scripting was: MagicLUA

Around Wikia's network

Random Wiki