Hi, I would like to use a function that is only in Lua 5.3, string.pack(), and I found a library that implements this function in Lua 5.2 : http://www.inf.puc-rio.br/~roberto/struct/
The problem is that I have absolutely no idea where to put the files and how to import it with Löve, can someone enlighten me ?
How to import a library like this one ?
How to import a library like this one ?
Don't panic and never forget your towel.
Re: How to import a library like this one ?
you can check out the teststruct.lua file, there are some examples including how to import.
Code: Select all
local lib = require"struct"
@pixelwar_studio on twitter
Re: How to import a library like this one ?
Thanks! But where do I put the files ? I tried to put them in the LOVE folder and it says it can't find 'struct'.
Don't panic and never forget your towel.
Re: How to import a library like this one ?
Not sure why would you need this, the FFI module already does that.
You need to build the C file (C source code) using supplied makefile with a "make" autotool. Then you put resulting dynamically loaded library binary and the accompanying .lua file in the same folder, because latter imports former. Note that because that would be an external library, you won't be able to use it from within zipped .love file, you'd need to export it to physical filesystem first.
You need to build the C file (C source code) using supplied makefile with a "make" autotool. Then you put resulting dynamically loaded library binary and the accompanying .lua file in the same folder, because latter imports former. Note that because that would be an external library, you won't be able to use it from within zipped .love file, you'd need to export it to physical filesystem first.
Re: How to import a library like this one ?
You put it into your project folder - i.e in the directory where your main.lua is located.Phlimy wrote:Thanks! But where do I put the files ? I tried to put them in the LOVE folder and it says it can't find 'struct'.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: How to import a library like this one ?
Nope, you compile the C file as the makefile indicates using Lua header files, then that should generate a .dll or .so depending on your OS, that file needs to be somewhere LÖVE can find it, if on Windows then that should be next to love.exe. Then you put struct.lua (not the .dll) inside of your .love file.
Using binary libraries is a pain so I don't recommend it, you should look for a way to use this feature without compiling anything.
Using binary libraries is a pain so I don't recommend it, you should look for a way to use this feature without compiling anything.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: How to import a library like this one ?
Thanks for these answers!
I managed to do what I wanted to do without it, but thank you very much anyway!
If I need anything like this again I'll know how to use it now.
I managed to do what I wanted to do without it, but thank you very much anyway!
If I need anything like this again I'll know how to use it now.
Don't panic and never forget your towel.
Who is online
Users browsing this forum: Amazon [Bot], slime and 2 guests