lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Nov 3, 2011 at 10:29 PM, David Manura <dm.lua@math2.org> wrote:
> file_slurp [1] provides simple functions to read/write entire files from/to a string.

Here's two more Perl-inspired modules written in the same style to
solve another common problem.

SYNOPSIS

  -- /qux/bar/baz.lua
  print(require 'findbin'.bin) --> prints directory of script (/qux/bar)
  require 'lib' (require 'findbin' '/../lib')
     -- adds a path relative to the directory of the current script to the
     -- package search paths (package.path & package.cpath).
  require 'foo'  -- loads from new search paths (/qux/lib/foo.lua)

[1] https://gist.github.com/1342365
     module 'findbin' - Locate directory of original Lua script
[2] https://gist.github.com/1342319
     module 'lib' - Simple insertion of directories in package search paths.
[3] https://gist.github.com/1325400
     module 'file_slurp' - Easily read/write entire files from/to a string.