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

what is your Lua script writing environment like?

  • 62 Replies
  • 19366 Views
*

Offline reyalp

  • ******
  • 12003
Re: what is your Lua script writing environment like?
« Reply #10 on: 11 / January / 2009, 21:24:35 »
Advertisements
mattime, use hostlua, it includes all the modified io and os libs
Don't forget what the H stands for.

Re: what is your Lua script writing environment like?
« Reply #11 on: 15 / January / 2009, 00:14:02 »
I'm trying to require('f-date.lua') but i get the following error -

./lua: test.lua:1: module 'f-date.lua' not found:
   no field package.preload['f-date.lua']
stack traceback:
   [C]: in function 'require'
   test.lua:1: in main chunk
   [C]: ?

i'm sure its because f-date.lua isn't a proper module. however, lua on chdk doesn't need proper packages.

do you have a simple way around this? or am i doing something wrong?

*

Offline reyalp

  • ******
  • 12003
Re: what is your Lua script writing environment like?
« Reply #12 on: 15 / January / 2009, 03:49:07 »
That means the file isn't found, probably because require automatically adds .lua at the end of whatever you give it. The module must also be in A/CHDK/SCRIPTS or A/CHDK/LUALIB relative to where lua runs.

require() works in hostlua.
Don't forget what the H stands for.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: what is your Lua script writing environment like?
« Reply #13 on: 15 / January / 2009, 12:23:08 »
For what it's worth,

Code: [Select]
require "f-disk"
is the syntax in sunsetF15 for CHDK/LUALIB/f-disk.lua.


Re: what is your Lua script writing environment like?
« Reply #14 on: 15 / January / 2009, 15:07:18 »
got it now, thanks!

Re: what is your Lua script writing environment like?
« Reply #15 on: 18 / January / 2009, 18:18:27 »
while its work, it seems to be missing a number of functions that are in the regular chdk build -

print_screen()
get_buildinfo()
get_time() not implemented, use os.date instead
shot_histo_enable
get_tick_count
get_free_disk_space
propcase=require("propcase") - doesn't work :(
get_prop

am i making a mistake? this lua build doesn't seem useful for my testing purposes. i'd be interested in extending it but i'm not a c programmer so i'd need some help getting started.

*

Offline reyalp

  • ******
  • 12003
Re: what is your Lua script writing environment like?
« Reply #16 on: 18 / January / 2009, 18:48:43 »
You can implement dummy versions of the functions you in lua. They can either do nothing, or set and return plausible values.

There's a couple things that do need to be in C (bitwise ops for example) but almost everything you need for a useful simulator can be done in lua. With function environments, you can hide the test stuff from the script you are testing.

My emu script has some examples of this, although as I said before, it's a very preliminary work in progress and not really ready for use yet.
Don't forget what the H stands for.

Re: what is your Lua script writing environment like?
« Reply #17 on: 18 / January / 2009, 19:38:42 »
i don't see much point in adding to a dead end effort. your new script is the path forward, correct?

i've exhausted myself in trying to set up a dev environment. it might be helpful in creating libraries but its not going to be helpful in making the full scripts. i'm going to move on with my main dev work and see if my ideal dev environment ever catches up.


*

Offline reyalp

  • ******
  • 12003
Re: what is your Lua script writing environment like?
« Reply #18 on: 18 / January / 2009, 19:43:24 »
i don't see much point in adding to a dead end effort. your new script is the path forward, correct?
Unless someone else comes up with something better before I finish it. Hopefully once I get the basic framework nailed down a bit better others will help flesh it out.
Don't forget what the H stands for.

Re: what is your Lua script writing environment like?
« Reply #19 on: 18 / January / 2009, 21:01:22 »
let me know when you can hand off tasks for the project. i'm interested in helping out.

 

Related Topics