lua-users home
lua-l archive

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




On Sat, Apr 28, 2018 at 11:23 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> So the idea came to me that it would be easier to maintain one copy of lua
> that can run the 5.1 dll/so and the 5.x dll/so based on a command line
> switch

Do you mean this?

#!/bin/sh
# usage: lua VERSION other args

V=$1
shift

echo exec /usr/local/bin/lua$V $@

Typical usage:  lua -51 foo.lua arg1 arg2 ... but all command-liine
switches are available.

This assumes the existence of /usr/local/bin/lua-51, lua-52, etc.

That's definitely the pragmatic approach to the problem, which is probably where I'll wind up. That said, the idea of wrapping lua in a batch script makes me sad and I don't want to spend money on a signing key for powershell (not to mention it's SLOW). 

The 'experiment' is a single executable to handle various configuration options and then modify luarocks to install a rock tree per directory. I'm using node.js at work and I liked being able to create a per directory or global rock tree. Both 'experimentalLua' and 'modluarocks' would be modified to look for configuration data. Said applications would first check the command line, then the local directory, then a global config. To handle 32 bit and 64 bit, the 32 bit executable would always be called first, which could then call the 64 bit executable if specified (I have no idea if that would work). 

At first I thought to write a wrapper. And then I thought, "Well, fuck, it's just a tiny C program. How complicated can it be"? (tee hee) The most portable and performant way to handle configuration is in C. In the end, modifying Lua itself seems like the best approach?

Thanks!
Russ