#1 Merged

Various patches

  1. jas43


Thanks for the great library. Here are some (minor) changes that I have found useful. A quick summary:

  • Interface to lua_setglobal to enable setting lua values from fortran.
  • Keep track of whether a Lua state is open or not.
  • Only open a new lua state in open_config if the state is not already open. This makes it possible to load multiple config files or (more importantly for my case) set some default values from fortran before loading the config file. It also helps avoid memory leaks from repeatedly calling open_config without calling close_config.

I realise the last change might be somewhat controversial. Please let me know what you think!


Comments (4)

  1. Harald Klimach repo owner

    Hi, thanks a lot for your contribution and input. Setting the initial for state with => c_null_ptr is actually something very sensible, however I think I had some problems with that with some compiler. Which compilers are you using?

  2. Harald Klimach repo owner

    I gave it now a try, the component initialization with c_null_ptr does not seem to work with gfortran 4.4.5 nor with 4.6.0, using an assignment (=) instead of pointer assignment (=>) however seems to work, which I think makes sense, as the component is not a Fortran pointer. See a946c49f359c, and let me know if this works for you. Thanks again for your changes, I think they are all pretty useful.

  3. jas43 author

    Sorry! I had imported aotus into my project (which is managed in git) and then merged my changes by hand (a crappy workflow, I know---I need to explore how to work between hg and git better) and that typo crept in. You're right, it absolutely should have used state=c_null_ptr rather than state=>c_null_ptr.

    Thanks for the accepting the changes. I'll send more patches as I have them. Please shout if there's anything I can help with.

    1. Harald Klimach repo owner

      I am using https://bitbucket.org/durin42/hg-git to mirror the git repository of waf in mercurial, I guess it should also work for the other way around. There is also https://github.com/offbytwo/git-hg. I could try to put up a mirror of this repository in git, however I am not sure how often I could promise to update it ;) I am glad, that you like this Lua interface, and would be happy to incorporate your contributions. If you'd like to I can also grant you commit access to this project. The actual coverage of the Lua API is currently pretty poor, we are really basically using this for configuration scripts and only concentrated on the things, that we needed to get that going... If you could contribute stuff, that you need for your application, and we'd keep a common project, that would be great ;)