I have a simple test.lua
script that creates a window using iuplua. I call it with lua C:\path\to\test.lua
. If I call it from C:\lua-5.4.4\iuplua
where all the iup libraries at, everything is fine no matter where the script itself is placed. The line from command prompt looks like that:
C:\lua-5.4.4\iuplua>lua C:\Users\username\Desktop\test.lua
But if I call it from any other directory but iuplua I get such error:
C:\Users\username\Desktop>lua test.lua
lua: error loading module 'iuplua' from file 'C:\lua-5.4.4\iuplua\Lua54\iuplua54.dll':
The specified module could not be found.
LUA_PATH:
C:\lua-5.4.4\bin\lua\?.lua
C:\lua-5.4.4\bin\lua\?\init.lua
C:\lua-5.4.4\bin\?.lua
C:\lua-5.4.4\bin\?\init.lua
C:\lua-5.4.4\bin\..\share\lua\5.4\?.lua
C:\lua-5.4.4\bin\..\share\lua\5.4\?\init.lua
.\?.lua
.\?\init.lua
LUA_CPATH:
C:\lua-5.4.4\bin\?.dll
C:\lua-5.4.4\bin\..\lib\lua\5.4\?.dll
C:\lua-5.4.4\bin\loadall.dll
.\?.dll
C:\lua-5.4.4\iuplua\Lua54\?54.dll
C:\lua-5.4.4\iuplua\Lua54\?.dll
C:\lua-5.4.4\iuplua\?54.dll
C:\lua-5.4.4\iuplua\?.dll
Last 4 lines in LUA_CPATH are added by me, but if I put package.cpath = package.cpath..";these 4 lines"
at the beginning of the script the result is the same.
OS is Windows 10, Lua version is 5.4.4, IUP version is 3.30, I didn't build it but downloaded binaries and Lua bindings from SourceForge: iup-3.30_Win64_dll16_lib
and iup-3.30-Lua54_Win64_dll16_lib
.
Can I do something to be able to launch lua not from iuplua folder but from everywhere I want?
Eventually, I just dropped all the dlls into bin
folder with lua.exe
and lua54.dll
. Added following paths to my LUA_CPATH
system variable:
C:\lua-5.4.4\bin\?.dll
C:\lua-5.4.4\bin\?54.dll
As much as I don't like having all IUPLua binaries in the same folder with Lua binaries, it seems it's the only way to do it.
Also, I can require iuplua
in the modern way like that: local anyname = require 'iuplua'
, but all other modules like iupluacontrols
or iuplua_plot
must be called in the old way: require 'iupluacontrols'
and require 'iuplua_plot'
. Then all functions from loaded modules are available in anyname
table.