Advice on using C libraries

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
AkirIkasu
Prole
Posts: 2
Joined: Sat Dec 28, 2024 2:02 am

Advice on using C libraries

Post by AkirIkasu »

Right now I'm in the very early planning stages to make an engine for tactical RPGs. As an idea for making it easy to configure it, I was thinking about using YAML configuration files, but the most common way to read YAML with lua is lyaml, which is only available as a rock because it has C code which will have to be compiled. Rocks are outside of my wheelhouse since I'm fairly new to using lua in any substantial way, but it's my understanding that if I were to install a rock it would only be available on my local system, so for public release I would have to either create an installer for each platform or build a modified version of love for each platform.

Of course in reality I don't actually want to do either of these things so I'll probably toss out the idea of using YAML altogether. But assuming I didn't want to do that, what would be the better action to take?

(Love is fantastic by the way - thanks to all involved)
RNavega
Party member
Posts: 389
Joined: Sun Aug 16, 2020 1:28 pm

Re: Advice on using C libraries

Post by RNavega »

Hi. Have you considered using other Lua scripts as configuration files?

viewtopic.php?p=58748#p58748

The syntax isn't as minimalist as YAML of course, but anyway, you'd use love.filesystem.load() to execute it on demand.
I used a Lua script to store an animated model for example: https://github.com/RNavega/2DMeshAnimat ... /asset.lua
AkirIkasu
Prole
Posts: 2
Joined: Sat Dec 28, 2024 2:02 am

Re: Advice on using C libraries

Post by AkirIkasu »

That's almost certainly the route I'll be taking. Really, I was just looking for advice on what to do if I need functionality from one of those C libraries.
RNavega
Party member
Posts: 389
Joined: Sun Aug 16, 2020 1:28 pm

Re: Advice on using C libraries

Post by RNavega »

Ok, understood.
AkirIkasu wrote: Sat Dec 28, 2024 2:19 am so for public release I would have to either create an installer for each platform or build a modified version of love for each platform.
Assuming that you've gathered your scripts and assets in a .love ZIP file, and then merged it with the appropriate LÖVE binary to create a fused package (as described in here), then you're right that you would only have to rebuild those third-party Lua C modules for the platform that you're targeting, and then distribute them together (installer, ZIP package, or as you said statically linking them to the LÖVE source code so it's in a single executable, though that seems like a lot of effort for which dynamic libraries are a good solution).
Hope you find a way and make some great games :awesome:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests