Recent Lua Library Findings

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Recent Lua Library Findings

Post by rude »

Just wanted to present two libraries I've come across recently.

Lua Lanes is a pretty awesome solution for multi-threading (with OS threads) in Lua which uses message passing instead of shared data. LuaThread is the shared data alternative which we have considered for inclusion into LÖVE before, but it requires a custom Lua build and is no longer maintained according to Diego Nehab (which by the way is the creator of LuaSocket). I added experimental support for Lua Lanes into LÖVE yesterday (I was immediately convinced of its potential), as it seems by far the best available solution for multi-threading.

BitOp provides bitwise functions (as previously requested by some users). This library is quite new, and it's the first bitwise operations library which appeals to me. I haven't included it yet, but I will if people are still interested. By the way: BitOp is created by the author of LuaJIT.

Also, if you want to see a Lua library in LÖVE, please do suggest it, though I can't promise to include everything.

Suggested:
  • SQLite
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Recent Lua Library Findings

Post by bartbes »

Lua Lanes sounds good, I myself have a wrapper of pthreads lying around, but the problem is when I write to variables and the other thread tries to read at the same time data corruption kicks in.

And you know I want SQLite, but I can't think of anything else..

You can always add luatcc (as I wrote in your other thread), but that's all, when I think of something I will post, don't worry :P.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Recent Lua Library Findings

Post by rude »

I immediately wanted to add tcc, but it seems hard to integrate. Tcc requires that you set the inclusion path for headers, and the path for libraries (compiled for the target platform). Depending on external files like that ... I don't like it.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Recent Lua Library Findings

Post by bartbes »

Yes, that's a strong case against it, but the alternative (Hate) doesn't sound that good either, as you said, you'd create 'just another engine' (tm).
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Recent Lua Library Findings

Post by rude »

I still like the idea of tcc in LÖVE, though. We'll see what's possible without compromising the loveliness of LÖVE.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Recent Lua Library Findings

Post by rude »

I made a quick test now, and it is possible to compile code without external directories set up, but then there would be no standard library. :rofl: It is possible to expose functions from the host app, though:

Code: Select all

/* Host app. */

#include <string.h>

int add(int a, int b)
{
    return a + b;
}

int main(int argc, char **argv)
{
    TCCState *s;
    /* Would allow add and strlen to be called from tcc-code. */
    tcc_add_symbol(s, "add", add);
    tcc_add_symbol(s, "strlen", strlen);
}
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Recent Lua Library Findings

Post by bartbes »

Well, you'd need to export the standard library, and some things related to LÖVE, do you have every function in C as well? Or do we need to start pushing variables? (those who know the Lua API know what I'm talking about)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Recent Lua Library Findings

Post by rude »

Only the Lua wrappers can be exposed. Everything else is C++ classes. I think if tcc is to be added, LÖVE will be kept some distance away from the C-world. General "data" could be passed to C functions for processing ... or something.
User avatar
Star Crunch
Prole
Posts: 33
Joined: Sun Feb 15, 2009 12:13 am
Location: Monterrey, MX
Contact:

Re: Recent Lua Library Findings

Post by Star Crunch »

Steve Donovan has been promoting Penlight, a big bunch of utilties, recently over on the Lua mailing list. I was going to mention this earlier but got distracted and lazy and stuff.

I think outside of the file operations it's pure Lua.
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Recent Lua Library Findings

Post by ljdp »

Post Reply

Who is online

Users browsing this forum: No registered users and 174 guests