pfirsich/lua-discordRPC

[Question] How does one acquire "ffi".dll?

PoPoWanObi opened this issue · 6 comments

From what I understand fii.dll is supposed to be built into the JitLibrary, and loaded using
local ffi = require("ffi")
But I'm getting an no file error for ffi.dll when I attempt to do this.

I compiled LuaJit for win32 and am using the DiscordRPC for win32.

Hopefully someone can explain this.

Thanks.

Hey, I'm not sure what to tell you, because that specific line you posted should just work in LuaJIT (see here: https://luajit.org/ext_ffi.html). I'll leave this open and see if someone else can help.

More info:

This issue comes up when I run
local discordRPC = require("discordRPC")
in my lua file.

This is how my folder looks:
Screenshot at 14-35-43

The actual error line is:

Lua runtime error: discordrp/discordRPC.lua:1: module 'ffi' not found:
no field package.preload['ffi']

Could you send me a zip of that folder?

[Removed folder]
Sure, no problem.

It seems to me you are running your script through some other program (there is an undefined global _addon) and that program ist just not using LuaJIT. If you open a console and do luajit.exe discordrp.lua you will see that the require works. And if you double click luajit.exe, you will get a prompt in which you can do both local ffi = require("ffi") and local discordRPC = require("discordRPC").
I am very confident this is not a problem of my library, so I will close this issue.

Thanks for the information, that makes sense. For some reason (and not sure why) I assumed it would load dynamically with the call from another application.