Pull requests

#3 Merged
Repository
jas43 jas43
Branch
default
Repository
haraldkl haraldkl
Branch
default

luaL_loadstring binding

Author
  1. jas43
Reviewers
Description

This set of patches adds a binding to luaL_loadstring.

I am not certain about the aotus-style binding though. (Is it dangerous to execute lua_openlibs multiple times? I couldn't find out...)

Happy to rework the patches if there's a better way of doing it.

Comments (4)

  1. Harald Klimach repo owner

    Thanks, looks very fine to me. Though we propably should consider a better aligned naming scheme for the two options to read Lua scripts, maybe open_config_file and open_config_chunk, or aot_read_file and aot_read_chunk. Opening the fluL libs multiple times should be fine I guess, however we could turn this into an option, that could be triggered by an argument. The error handling stuff is now quite verbose and duplicative, so it would be nice if this common part of the two routines could be put into a routine of its own.

    1. jas43 author

      Good idea about the error handling---I should have spotted this at the time. Sorry about leaving debug output in the pull request (which you removed later). Pull request coming.

  2. Harald Klimach repo owner

    Also I thought about providing an aotus handle over the flu_State, with a path included, this could also be used to store, if the libs are already loaded or not.

    1. jas43 author

      You mean something like

      type :: flu_State private type(c_ptr) :: state = c_null_ptr logical :: flu_libs_open = .false. end type flu_State

      and then setting flu_libs_open appropriately in fluL_openlibs?