OK thank you Scuri and Francisco. I executed a string to set package.cpath and package.path and that worked. Simon From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Antonio Scuri Sent: 28 March 2019 1:39 PM To: Lua mailing list Subject: Re: LUA_CPATH environment variable value not detected in Lua script Hi, You could execute the Lua string: package.cpath = “c:\\Program Files (x86)\\My App\\?53.dll” In C before loading the DLLs. Simon:
On Wed, Mar 27, 2019 at 10:26 PM Simon Orde <SimonOrde@family-historian.co.uk> wrote: ...> Before I upgraded my application, I previously ran Lua 5.1 using the same method for setting the LUA_CPATH environment variable. If I call str = os.getenv("LUA_CPATH") in a script in that version of my application, it returns what I was expecting – the path I’d set it to. So why is it nil now? Is this a difference in behaviour between Visual Studio 2010 and 2017? Can anyone suggest what’s going wrong? All help much appreciated.
If os.getenv is working, it is in the environ. In the uses of lua we have we alter package.cpath directly after creating the states ( as we use multiple states with different setting in each ), and the manual says..."Lua initializes the C path package.cpath in the same way it initializes the Lua path package.path, using the environment variable LUA_CPATH_5_3, ", but it is not clear to me if "Lua" here referes to the library or the executable, so I went for the "use the source" and found it int the luaopen_package. I think you may not be loading the package library ( I do not know if require does it for you, or any other thing, nor nearly enough data to check, and not familiar enough with 5.1 to know if this has changed, but you should be ).
Francisco Olarte.
|