what is your Lua script writing environment like? - page 6 - LUA Scripting - CHDK Forum

what is your Lua script writing environment like?

  • 62 Replies
  • 36017 Views
*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: what is your Lua script writing environment like?
« Reply #50 on: 22 / April / 2013, 14:33:34 »
Advertisements
What problems does it cause? Maybe we can make it better.

It's not really a major issue. It is more an organizational problem. All emulation files should be in one folder. But it is necessary that the file camera_funcs.lua is in A\CHDK\LUALIB.

For our notepad++ project we have a project folder:
Code: [Select]
hostlua\
       A\CHDK\LUALIB\ <all CHDK relevant Lua libraries>
       bin\
              chdkptp.exe
              emu.lua
              hostlua.cmd
              lremote.lua
              lua.exe
              luac.exe

It would be nice if we could insert camera_funcs.lua into the bin folder. But this does not work.

msl
CHDK-DE:  CHDK-DE links

*

Offline reyalp

  • ******
  • 14125
Re: what is your Lua script writing environment like?
« Reply #51 on: 22 / April / 2013, 17:25:57 »
It would be nice if we could insert camera_funcs.lua into the bin folder. But this does not work.
It should be possible to do this, as long as you are using lua.exe built from the latest trunk (2723 or later) hostlua. In fact, the default lua path should include the executable directory, so I would expect it to work without changes. If for some reason it isn't, you should be able to set LUA_PATH in the environment before executing it lua.exe.

If you can't get it to work let me know what the error message is. The working directory of lua.exe may also be relevant.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: what is your Lua script writing environment like?
« Reply #52 on: 22 / April / 2013, 17:35:22 »
If there's any documentation you could give me a pointer to I would appreciate that. Mainly to avoid wasting your time with my questions:)
There's no documentation outside of this thread and the relevant scripts

1) hostlua is a version of the lua standalone interpreter which is configured like CHDK lua (numbers are ints, various other CHDK specific hacks). See http://www.lua.org/manual/5.1/manual.html#6 for information about the standalone interpreter
2) emu.lua is a lua script which provides many of the functions that CHDK provides, and has the ability run other lua scripts in this environment.
3) The idea is that you can test and debug some aspects of your script without loading it on the camera.

As described in the emu.lua file, you can execute it like this
Code: [Select]
lua.exe emu.lua <name of your chdk lua script>
If you want to provide menu variables (a, b c etc) to your script, you can put -a=<number> -b=<number> etc on the command line.
Don't forget what the H stands for.

Re: what is your Lua script writing environment like?
« Reply #53 on: 23 / April / 2013, 03:58:53 »
The problem is that I got no lua.exe executable. I got for example dancingbits.exe, finsig_dryos.exe, makelang.exe and so on, but no lua.exe...

CHDK from which I compile is current trunk (https://tools.assembla.com/svn/chdk/trunk).

Regards!
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: what is your Lua script writing environment like?
« Reply #54 on: 23 / April / 2013, 04:44:11 »
The problem is that I got no lua.exe executable. I got for example dancingbits.exe, finsig_dryos.exe, makelang.exe and so on, but no lua.exe...

CHDK from which I compile is current trunk (https://tools.assembla.com/svn/chdk/trunk).

Regards!

cd tools/hostlua
make

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: what is your Lua script writing environment like?
« Reply #55 on: 23 / April / 2013, 05:43:52 »
The problem is that I got no lua.exe executable. I got for example dancingbits.exe, finsig_dryos.exe, makelang.exe and so on, but no lua.exe...

CHDK from which I compile is current trunk (https://tools.assembla.com/svn/chdk/trunk).

Regards!

cd tools/hostlua
make

Phil.


Thx - worked. I feel stupid...
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: what is your Lua script writing environment like?
« Reply #56 on: 24 / April / 2013, 06:40:31 »
Thank you reyalp for your good work!
I could now change the position of camera_funcs.lua width new lua.exe and LUA_PATH. Only the bitwise operations are missing. Is imath-library a better (easier) place instead emu.lua implementation?

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: what is your Lua script writing environment like?
« Reply #57 on: 24 / April / 2013, 15:04:53 »
It should be possible to do this, as long as you are using lua.exe built from the latest trunk (2723 or later) hostlua.

That was it. As rudi wrote, now is all fine. Thank you for your help.

msl
CHDK-DE:  CHDK-DE links

*

Offline reyalp

  • ******
  • 14125
Re: what is your Lua script writing environment like?
« Reply #58 on: 24 / April / 2013, 15:47:09 »
Thank you reyalp for your good work!
I could now change the position of camera_funcs.lua width new lua.exe and LUA_PATH. Only the bitwise operations are missing. Is imath-library a better (easier) place instead emu.lua implementation?
I was thinking about moving this to it's own C file, which could be used for both CHDK and hostlua.
Don't forget what the H stands for.

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: what is your Lua script writing environment like?
« Reply #59 on: 09 / January / 2015, 16:41:41 »
Here is an updated emu.lua for new #params. It was tested with parmtest.lua.
Not so good is the different start index from lua tables and #values. Lua table functions can't use for #values with table extension in script.

rudi

EDIT: delete emu.lua, see next post
« Last Edit: 18 / January / 2015, 12:48:38 by rudi »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal