End script in Lua - page 2 - LUA Scripting - CHDK Forum

End script in Lua

  • 11 Replies

Offline fudgey

  • *****
  • 1705
  • a570is
Re: End script in Lua
« Reply #10 on: 21 / October / 2008, 16:22:31 »
use metamethods so you can do
propcases.quality = X ;)

table lookup is only a couple instructions, so there's no way it should require  1000 :) (that's an arbitrary limit anyway, if it becomes a problem it isn't that hard to work around)

Doing some stuff along these lines is actually on my TODO list, but as you may have noticed, I've been able to devote much time to CHDK in the last couple weeks. I have several things in mind that will become standard lua modules in the CHDK distribution. Then people can just require what they need, and we don't have to bloat the chdk core.

Ah, tables... Did I tell you I was a noob in Lua?  :D Well, how about this:?

Attached is a shell script that takes platform.h (ok the awks are a bit hazy if someone ever adds a new propset or reorders the current propsets) and spits out propcase.lua (also attached, I didn't try it in the cam, but it appears to run on Ubuntu's Lua 5.1 if I give it a dummy get_propset()).


Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: End script in Lua
« Reply #11 on: 22 / October / 2008, 17:58:46 »
hm, it's about time all the "standard" ubasic scripts get translated to lua. also we need a few good example scripts, so people can learn fast.


Related Topics

SimplePortal 2.3.6 © 2008-2014, SimplePortal