lua-users home
lua-l archive

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


Title: Re: Forcing Lua on Windows to use a standalone folder



Friday, February 6, 2015, 10:19:12 AM, you wrote:


If all hope is lost you could maybe modify package.path and other things related to package. I've had similar issues with lua for windows. Setting PATH from batch should work though.
On 31 Jan 2015 20:21, "Rena" <
hyperhacker@gmail.com> wrote:
On Sat, Jan 31, 2015 at 9:02 AM,  <
mchalkley@mail.com> wrote:
>
>
> Friday, January 30, 2015, 12:31:40 PM, you wrote:
>
>> On Fri, Jan 30, 2015 at 10:43 AM,  <
mchalkley@mail.com> wrote:
>>> I've got to add a feature to a Lua program I wrote several years ago,
>>> but it was 5.1 and uses sigar to check system stuff (Disk, memory, &
>>> CPU usage, etc.) and sigar is broken on 5.2.
>>>
>>> My machine now has a 5.2 LuaRocks installation, and I can't figure out
>>> a way to get lua to ignore all the system environment variables from
>>> within a command prompt window.
>>>
>>> For example, if I run the lua script on a target machine that doesn't
>>> have lua installed, it runs fine, but if I run it on my machine, I get
>>> all kinds of module not found warnings, etc.  If I resolve those, lua
>>> barks about lua52.dll being missing, even though it's running 5.1.
>>>
>>> Any ideas on how I can make a command prompt window ignore everything
>>> but what's in the folder I'm running from?  Setting %PATH% to just ;
>>> doesn't help - lua continues to look in the LuaRocks\Systree... folder
>>> for lfs, etc.
>>>
>>>
>
>> Don't you also have to set LUA_PATH and LUA_CPATH?
>
> I thought that would do it, but no matter what I set them to, even to
> the absolute current path name, I get a "module 'lfs' not found" on
> the require...
>
>

Take a look at the list of paths it tried (part of the error message)
and make sure lfs is actually there...


Thanks - that's what it came down to.  Rena put me on the right track, too.

In case anybody else ever needs to know, in the end, I needed to add 

loadfile("socket.lua") ()

to my script, from a suggestion by Andrew Cannon in this list's archives, as well as set the following paths:

set LUA_PATH=?.lua;..\?.lua;
set LUA_CPATH=?.dll

The next thing I'm going to be asking questions on, most likely, is the best way to bundle and distribute the whole package to Windows servers in as few files as possible...