Lua Scripting - Feature Requests - CHDK Forum

Lua Scripting

  • 14 Replies
  • 11670 Views
*

Offline Velo

  • *
  • 30
Lua Scripting
« on: 23 / April / 2008, 15:53:50 »
Advertisements

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Lua Scripting
« Reply #1 on: 23 / April / 2008, 16:00:07 »
what is lua? why is it the ideal language? what restrictions in BASIC are you referring to?
why am i asking this? why is your post lacking information? because you didnt provide any.
please answer my questions, then maybe other people can answer your questions :)

*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: Lua Scripting
« Reply #2 on: 23 / April / 2008, 16:57:26 »
Basic was chosen because a very small implementation (uBasic) was readily available and was extremely "lightweight" in terms of memory etc. Consider that all the source code of Ubasic is well under 1.000 lines (25k of source). The requirement in terms of other libraries is extremely small (IIRC only printf() and exit() are required!)

By contrast Lua has 437 Kbytes of source code for over 15.000 lines of code. Moreover, it strongly relies on the C standard libraries...

too much power required! After all out cameras are not PCs :-)

*

Offline Velo

  • *
  • 30
Re: Lua Scripting
« Reply #3 on: 25 / April / 2008, 17:20:17 »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Lua Scripting
« Reply #4 on: 25 / April / 2008, 19:19:39 »
hm good luck then :)
after reading this technical note, i think that by reducing the size of the lua core, you also lose the ability to parse scripts, thus you have to feed it precompiled bytecode, eh? that would render the concept of "scripts" kind of useless. correct me if i'm wrong.
you are more than welcome to try to implement this :)
but maybe you can invest some time & brains into coding a editing function that uses the camera keyboard before? :) this way one would not have to rely on a computer to write one's scripts on. makes in-camera-debugging way easier and subsequently the use of ubasic.
whatever you do, have fun while doing it and let us know what you are up to :)

*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: Lua Scripting
« Reply #5 on: 26 / April / 2008, 02:52:59 »
but maybe you can invest some time & brains into coding a editing function that uses the camera keyboard before? :)

I would LOVE this :-)

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: Lua Scripting
« Reply #6 on: 26 / April / 2008, 06:23:51 »
but maybe you can invest some time & brains into coding a editing function that uses the camera keyboard before? :)

I would LOVE this :-)


I would LOVE this too - an editing feature (for scrips) would be phenomenal !

*

Offline Velo

  • *
  • 30
Re: Lua Scripting
« Reply #7 on: 26 / April / 2008, 12:15:14 »

*

Offline Velo

  • *
  • 30
Re: Lua Scripting
« Reply #8 on: 26 / April / 2008, 17:16:15 »
Well here it is: the first Lua script running on my IXUS 70.

Code: [Select]
for i = 1,10 do
  print( "Picture "..i )
  shoot()
  sleep( 2000 )
end

I am already in the process to port more complex scripts to Lua. It is mostly straight forward. And they get much better to read and understand.

Still missing is error handling and script parameters.

New features include:
- variable names longer than 1 char
- no 10 ms delay between different code lines (only for commands that do something with the camera like "press" or "shoot")
- bug free scripting language
- functions
- data structures (Lua tables can be used as arrays or associative containers)
- strings
- garbage collection
- coroutines
- (and more I possibly forgot about)


*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: Lua Scripting
« Reply #9 on: 26 / April / 2008, 18:02:56 »
Well, I must say I am impressed!
keep up the good work!

 

Related Topics


SimplePortal © 2008-2014, SimplePortal