lua-users home
lua-l archive

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


Dear Andre, Viacheslav and pocomane

Since I need it for linux/mingw/osx, I can use setenv (which works). If I wasn't crap at reading man pages I could have figured that one out myself.

Thank you for your quick reply, kind regards,
-S


On Fri, Jul 20, 2018 at 9:20 AM, pocomane <pocomane_7a@pocomane.com> wrote:
On Fri, Jul 20, 2018 at 7:53 AM Simon Wunderlin <swunderlin@gmail.com> wrote:
>
> Dear lua developers and users
>
> I recently decided to embed Lua into a C Application. The requirements are:
> - minimal dependencies
> - Linux and later windows (mingw) and OSX
>
> For my application to work I need to set environment variables. Therefore I have written a simple Lua C extensions to do so: https://pastebin.com/NsNMHkUu

Maybe a bit offtopic, but...

If you want to set env variables, probably you also want to spawn
sub-process, and maybe read/write its output/input. Luachild [1]
module can do all of this for you, and nothing else. It is "Minimal"
code extracted from the Ex module of LuaDist. It uses setenv for
setting variables, or SetEnvironmentVariable on windows.

Moreover, there are some alternatives listed in the readme.

[1] https://github.com/pocomane/luachild - MIT license - Credit to the
original author, Mark Edgar.




--
Insanity: doing the same thing over and over again and expecting different results.