lua-users home
lua-l archive

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


Am 20.05.2014 17:24 schröbte Andrew Starks:
On Tue, May 20, 2014 at 5:07 AM, Philipp Janda <siffiejoe@gmx.net> wrote:

Someone mentioned MS had rules for the locations of modules, scripts, etc.
I'd rather see those locations added on Windows (or use the paths from LfW
or LuaDist), so that you can write an installer for Lua that fits well with
the rest of the Windows ecosystem (although an installer could just as
easily set environment variables and/or use the paths relative to the
executable).


I mentioned this. If one were to be installing Lua for desktop use, then
modules should be stored in a `%APPDATA%`\lua folder and a second search
tree rooted in `%USERPROFILE%\\lua`. This [1] is a good summary of all of
the relevant variables and what they're for. But I understand if this is
deemed beyond the scope of intent for the main tar ball.

We would need support for evaluating env variables in LUA_PATH first, but that is not out of reach, `getenv` is C90.


If Lua is a sandbox for applications, then the current configuration is
ideal, provided there is a decent VS project. Right now, this [2] is as
good as it gets.

Oh, and [3]. :)

-Andrew

[1] http://technet.microsoft.com/en-us/library/cc749104(v=ws.10).aspx

[2]
http://techneilogy.blogspot.com/2012/02/compiling-lua-with-visual-studio-2010.html

[3] Also, I think a further discussion about practical methods to handle
writing modules for multiple 5.X versions of Lua and also, secondarily,
using them. In particular, I still like the idea that the actual search
path in Lua 5.3 might support specific version trees, with fallbacks to
general "lua" trees. My suggestion was
"user_lua/5.3->user_lua->lua/5.3->user_lua->cur_dir/5.3->cur_dir". This
would make it possible to write modules that could optionally use different
files as a way to manage differences, which might be more important in 5.3
than it was for 5.1-5.2.

I'd probably use

    if _VERSION == "Lua 5.3" then
      X = require( "mymodule.bitfiddling" )
    else
      X = require( "mymodule.generic" )
    end

and install the whole bunch of files for every Lua version. If you can afford installing multiple Lua binaries, some superfluous `.lua` files won't hurt (and you won't have to install the same bitfiddling module twice when Lua 5.4 comes out) ...


Philipp