What is PYTHONPATH counterpart for Lua? - lua

I like to make some of my own classes available system-wide in Torch7. In python it is enough to give the class files paths to PYTHONPATH environment variable. Is there any equal way to do this for Lua?

The environmental variable you are looking for is LUA_PATH
At start-up, Lua initializes this [package.path] variable with the value of the environment variable LUA_PATH_5_3 or the environment variable LUA_PATH or with a default path defined in luaconf.h, if those environment variables are not defined. Any ";;" in the value of the environment variable is replaced by the default path.
For example, to have Lua look for files in /home/bob/lualibs, you would set LUA_PATH to /home/bob/lualibs;;

Related

Vite environment variables

The doc says:
To prevent accidentally leaking env variables to the client, only variables prefixed with VITE_ are exposed to your Vite-processed code
How does one use a variable not prefixed with VITE_?

Not able to set ENV LUA_PATH No such file or directory

I am working on open source LUA project. It has some modules and submodules. I am trying to set LUA_PATH env. But it always fails with error.
bash: ./user_modules/shared_testcases/?.lua: No such file or directory
Command I used is:
set LUA_PATH /usr/local/share/lua/5.2/?.lua;./user_modules/shared_testcases/?.lua
You need to quote the path:
set LUA_PATH '/usr/local/share/lua/5.2/?.lua;./user_modules/shared_testcases/?.lua'
Otherwise, as you have seen, the shell tries to expand the ?
in the path.

Where is the environment variable written?

I am using Yocto, when i run command env, i could see couple of variables have been set. But when I open up /etc/environment, those variable is not in there.
When i set variable in /etc/environment, for example, proxies, it is not reflected to my system.
How can I know where's the environment variable file?
Thank you.
Yocto environment is set by executing oe-init-build-env script. You can add bitbake variables in local.conf file.

How to add to full environment path?

I need to add two directories to the environment path, but when I enter the first it gets cut of in the middle. It seems to me my environment path is full(there are quite a lot of things in there).
How can I add my two directories to the environment path?
I'm using Windows 7.
I guess you're working in windows.
Make 2 new environment variables.
Then add the 2 environment variables to the environment path by name like this:
%variable_name1%;%variable_name2%;
In windows:
PATH="PATH1";"PATH2";%PATH%
In Unix:
PATH="PATH":"PATH":%PATH%
Note: Quotes are requires if path contains spaces in between like c:\Program Files\abc

How to set Environment variables using Ant

It looks like this question has been asked many times. I searched but I could not get the answer
I am looking for techniques on how to set environment variables in Windows system using Ant
I have around 10 environment variables that needs to be set before I can start the compile using Ant
I am running on Windows system.
any help would be appreciated
Thank you,
Karthik
There is no way to set environment variables through Ant.
The property task can only be used for getting the value of an already set environment variable.
You would need to call Ant's exec task and pass the command line (for your operating system) to set the value of an environment variable.

Resources