How do I use modules in Lua? - module

I'm trying to develop a discord bot with lua using discordia.
But it is looking for the module in another directory even though it installed properly.
The same goes for other modules installed with Luarocks.
To solve this, I added the lualox directory to the path, but the same result was output.
How to get this to load the module in the correct directory?
C:\Program Files\Lua\lua-5.4.2_Win64_bin\lua54.exe: C:\Users\---\Downloads\Projects\Lua\Discordbot\main.lua:1: module 'discordia' not found:
no field package.preload['discordia']
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\lua\discordia.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\lua\discordia\init.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia\init.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\..\share\lua\5.4\discordia.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\..\share\lua\5.4\discordia\init.lua'
no file '.\discordia.lua'
no file '.\discordia\init.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia.dll'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\..\lib\lua\5.4\discordia.dll'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\loadall.dll'
no file '.\discordia.dll'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia54.dll'
no file '.\discordia54.dll'
stack traceback:
[C]: in function 'require'
C:\Users\---\Downloads\Projects\Lua\Discordbot\main.lua:1: in main chunk
[C]: in ?
Instead of require("discordia"), I used require("C:.Users.---.Downloads.Projects.Lua.Discordbot.deps") but it still doesn't load the module (same for Luarocks directory)

Related

How to add icons in PyQt5 app in flatpak?

I have small PyQt5 app: https://github.com/taunoe/tauno-serial-plotter
I got all the functionality to work on flatpak but icons are a problem. Tried different things, but i have no clue how to make them showup.
(base) taunoerik#pop-os:~/Documents/MyGitHub/tauno-serial-plotter$ flatpak run
org.flatpak.Tauno-serial-plotter /app/bin/python3
Gtk-Message: 15:15:29.163: Failed to load module "appmenu-gtk-module"
Gtk-Message: 15:15:29.199: Failed to load module "canberra-gtk-module"
Gtk-Message: 15:15:29.199: Failed to load module "canberra-gtk-module"
Qt: Session management error: None of the authentication protocols specified are supported
qt.svg: Cannot open file '/home/taunoerik/img/tauno-plotter.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/tauno-plotter.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/arrow_down.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/arrow_down.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/arrow_down.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/arrow_down.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/plus.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/plus.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/minus.svg', because: No such file or directory
qt.svg: Cannot open file '/home/taunoerik/img/minus.svg', because: No such file or directory
File names should be absolute. Like:
filename = os.path.join(os.path.dirname(__file__), 'icons/file.svg')
Note relative like this: filename = './icons/file.svg'

FileExplorer not showing folder for VBE7.dll that does exist (Yes...Hidden folders are being shown)

I am curious to modify the .dll file for VBA based on these suggestions to get a custom color scheme.
When I inspect references in the VBA Editor I see a reference to
C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.dll
Problem:
Using File Explorer or Chrome, it appears the VBA folder does not exist. There is no VBA folder at
C:\Program Files\Common Files\Microsoft Shared
Image showing VBA folder does not exist
In my File Explorer options I have configured to show hidden and protected folders. I believe it should be showing based on my settings.
My File Explorer Settings 1/2
My File Explorer Settings 2/2
How can I find the file at my destination, in order to backup and modify it? Since VBA does work on my machine, I am confident it does exist.
If you have 32 bit office it would not be there but at C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.dll.
I'm using Office 2019 (Microsoft® Excel® for Microsoft 365 MSO (16.0.14326.20850) 32-bit
After running an extensive search for that dll on my entire PC, I found it here:
c:\Program Files (x86)\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1\

Why is this IronPython module path not visible?

I am trying to find the location of a IronPython module on my PC. According to this code:
import xml.etree.ElementTree as ET
print(ET.__file__)
...the path to the module is
'C:\Program Files (x86)\IronPython 2.7\Lib\xml\etree\ElementTree.py'
However when I look up this path there is no 'xml' in 'Lib'
Why could this be?

Open a gz file using Minizip Library

I'm trying to open a gz file with Minizip library (built on zlib).
Here is the code:
......
......
unzFile uf = unzOpen("MyFile.gz");
......
But Visual Studio 2013 crashes with this message:
Debug Assertion Failed!
file open.c
line 98
Expression: ("Invalid file open mode",0)
What could it mean?
A .gz file is a single file that's been compressed.
A .zip file is a compressed archive; i.e. a hierarchical structure of compressed files.
tl;dr minizip doesn't support .gz files as it's not a .zip file.

How to use ilMerge to merge dll into an exe file? [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Merging .dll with .exe
Okay, so... I have all the files of ilmerge, along with the .exe (CabalMain.exe) and the dll (crckd.dll) in one path. C:\Program Files (x86)\Microsoft\ILMerge
I shift>rightclick folder and open up command prompt.
Since I'd like to merge the two I enter:
C:\Program Files (x86)\Microsoft\ILMerge>C:\Program Files (x86)\Microsoft\ILMerg
e\ilmerge C:\Program Files (x86)\Microsoft\ILMerge\Cabalmain.exe C:\Program File
s (x86)\Microsoft\ILMerge\crckd.dll /out:C:\Program Files (x86)\Microsoft\ILMerg
e
(I believe that is the correct process to merge)
And I received
C:\Program Files (x86)\Microsoft\ILMerge>C:\Program Files (x86)\Microsoft\ILMerg
e\ilmerge C:\Program Files (x86)\Microsoft\ILMerge\Cabalmain.exe C:\Program File
s (x86)\Microsoft\ILMerge\crckd.dll /out:C:\Program Files (x86)\Microsoft\ILMerg
e
Simple instructions would be appreciated.
As you have now copied every thing in the programs folder of ilmerge (which is not wise and was adviced against in the duplicate question) the correct command (from the ilmerge folder) should be:
ilmerge cabalmain.exe crckd.dll /out:%userprofile%\cabalmainmerged.exe
If no errors are shown you can type start %userprofile% and in the explorer window that opens you should find cabalmainmerged.exe
'Could not load assembly ' means that the exe or dll files that you try to merge are not copied to the correct folder. If one of the exe or dll's depend on other assemblys they all have to be in the same folder.
Wiser is to have a folder c:\merge and copy all relevant files in that folder. Then start a commandprompt and
c:
cd\merge
then
"C:\Program Files (x86)\Microsoft\ILMerge\ilmerge" "yourexe.exe" "your1stdll.dll" /out:mergedexe.exe