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

what is your Lua script writing environment like?

  • 62 Replies
  • 36058 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: what is your Lua script writing environment like?
« Reply #30 on: 20 / April / 2013, 19:08:08 »
Advertisements
I'm getting the same error on Linux using Hacki's toolchain so perhaps there's a problem with that.
All the missing function are in lib/math/wrapper.c

No, hostlua is compiled for the host system, not CHDK.
It should be picking up the functions from libm; but even forcing it to load this library (-lm) doesn't work with Hacki's toolchain.

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)

*

Offline srsa_4c

  • ******
  • 4451
Re: what is your Lua script writing environment like?
« Reply #31 on: 20 / April / 2013, 19:18:24 »
It builds on my OpenSuse (x86) machine. The ARM toolchain is not even on my PATH, so it's an issue with the host environment.

*

Offline nafraf

  • *****
  • 1308
Re: what is your Lua script writing environment like?
« Reply #32 on: 20 / April / 2013, 21:03:51 »
Yes, it seems to be an issue with the host environment. This patch seems to solve problem in Ubuntu.

Re: what is your Lua script writing environment like?
« Reply #33 on: 20 / April / 2013, 21:08:27 »
Yes, it seems to be an issue with the host environment. This patch seems to solve problem in Ubuntu.
Awesome!  Works now for me - fedora17 64 bit system.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14126
Re: what is your Lua script writing environment like?
« Reply #34 on: 20 / April / 2013, 23:37:43 »
Yes, it seems to be an issue with the host environment. This patch seems to solve problem in Ubuntu.
Checked in on the trunk, should be harmless on systems that don't need it.
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: what is your Lua script writing environment like?
« Reply #35 on: 21 / April / 2013, 03:24:31 »
Yes, it seems to be an issue with the host environment. This patch seems to solve problem in Ubuntu.
Checked in on the trunk, should be harmless on systems that don't need it.

Still didn't work on Hacki's toolchain (64 bit Linux).
Nafraf's patch does work - the '-lm' needs to go after the object file names (patched in rev 2716).

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 #36 on: 21 / April / 2013, 10:40:59 »
The lua interpreter created by hostlua/make is now running.   However,  I'm stumped on how to get it to work when there is a require directive in my code. 

Code: [Select]
require "drawings" gives me :
lua: emu.lua:554: error running testpgm.lua testpgm.lua:47: module 'drawings' not found:
   no field package.preload['drawings']


The regular lua on my PC has a long path it searches  ( print(package.cpath)  ) but the with hostlua version that variable shows up as "nil".   Somehow the hostlua version must need an environment setup but how?

(I have the CHDK files all loaded in a subdirectory  "A/" in the same directory as the hostlua interpreter.)
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: what is your Lua script writing environment like?
« Reply #37 on: 21 / April / 2013, 10:59:36 »
A 'A\' environment is ok.  'require' does not work with hostlua. We found out this:

require("propcase") leads to an error.

require("GEN/propset"..tostring(get_propset())) works.

The attached file is an advanced Lua emulation file, emu.lua. So you can test more camera dependent functions.

msl
CHDK-DE:  CHDK-DE links

Re: what is your Lua script writing environment like?
« Reply #38 on: 21 / April / 2013, 11:20:15 »
A 'A\' environment is ok.  'require' does not work with hostlua. We found out this:

require("propcase") leads to an error.

require("GEN/propset"..tostring(get_propset())) works.
Thanks for the hints but when I insert that exactly as written I still get :

lua: emu.lua:554: error running testpgm.lua testpgm.lua:46: module 'GEN/propset4' not found:
   no field package.preload['GEN/propset4']



The attached file is an advanced Lua emulation file, emu.lua. So you can test more camera dependent functions.

I also found that emu.lua on the CHDK-DE forum.   I've started adding to it as well - get_IS_mode() for example.

It might be good to add it to the chdk svn tree somewhere so we can version control additions ?


« Last Edit: 21 / April / 2013, 11:35:22 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14126
Re: what is your Lua script writing environment like?
« Reply #39 on: 21 / April / 2013, 14:58:04 »
Still didn't work on Hacki's toolchain (64 bit Linux).
Nafraf's patch does work - the '-lm' needs to go after the object file names (patched in rev 2716).
Ah right, some GCCs are more sensitive about the order. -lm at the end fixed it for my linux x64 toolchain  :-[

require("propcase") leads to an error.

require("GEN/propset"..tostring(get_propset())) works.
It would be good to identify why and fix this, rather than requiring changes in the scripts.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal