Page 1 of 1

LuaFileSystem with Love2D

Posted: Wed Oct 29, 2014 8:19 pm
by GanMatt
Hey I installed LuaFileSystem using LuaRocks and Love2D couldn't find the library.

The lfs.so file was in lua 5.2. I moved it to lua 5.1 so it could find it. Now I get a separate error:
Error: error loading module 'lfs' from file '/usr/local/lib/lua/5.1/lfs.so':
dlopen(/usr/local/lib/lua/5.1/lfs.so, 6): Symbol not found: _luaL_setfuncs
Referenced from: /usr/local/lib/lua/5.1/lfs.so
Expected in: dynamic lookup

stack traceback:
[C]: at 0x7fff04caa140
[C]: in function 'require'
//IOController/IOController.lua:4: in main chunk
[C]: in function 'require'
Game.lua:5: in main chunk
[C]: in function 'require'
main.lua:2: in main chunk
[C]: in function 'require'
[string "boot.lua"]:360: in function <[string "boot.lua"]:241>
[C]: in function 'xpcall'
Is there a way to fix this?

Thanks,
Gan

Re: LuaFileSystem with Love2D

Posted: Wed Oct 29, 2014 8:28 pm
by slime
It looks like your copy of luafilesystem was built for Lua 5.2, whereas LÖVE uses LuaJIT (which is only API/ABI compatible with Lua 5.1.)

Also, what do you need lfs for that love.filesystem can't do?

Re: LuaFileSystem with Love2D

Posted: Thu Oct 30, 2014 2:21 am
by GanMatt
I'm writing a map editor, I just finished the world editing and saving and loading last night but I want to save the maps in the source directory instead of the application support directory. The reason for this is so that when I edit a map, I can hit commit in git and my buddy can edit the same world as me.

Copying the saved world into the repository for every edit so my buddy and I can collaborate is too tedious. I'm gonna use Lua File System to save the data in the repository folder with the source.

Is there a way to make Lua File System compile with Lua 5.1 to be compatible with Love2D?

Re: LuaFileSystem with Love2D

Posted: Thu Oct 30, 2014 2:53 am
by GanMatt
I got it working in a weird way.

Downloaded the previous official version of Lua File System, then I added this line to the C code:
#define luaL_reg luaL_Reg

Ran make and install and boom. Works. Love2D loads it without problem. Now I just hope it runs without issue.


I suppose I could ask if there's a better way to go about this...


Edit: On a side note is there a way to load a .so module from the src folder?

Re: LuaFileSystem with Love2D

Posted: Sun Oct 15, 2017 10:54 am
by TC1061
:( I'm trying to use LFS in the love2d 0.10.2, but it crashes!