LuaFileSystem with Love2D

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
GanMatt
Prole
Posts: 3
Joined: Wed Oct 29, 2014 8:16 pm

LuaFileSystem with Love2D

Post 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
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: LuaFileSystem with Love2D

Post 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?
GanMatt
Prole
Posts: 3
Joined: Wed Oct 29, 2014 8:16 pm

Re: LuaFileSystem with Love2D

Post 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?
GanMatt
Prole
Posts: 3
Joined: Wed Oct 29, 2014 8:16 pm

Re: LuaFileSystem with Love2D

Post 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?
User avatar
TC1061
Prole
Posts: 32
Joined: Sat Oct 14, 2017 3:50 pm

Re: LuaFileSystem with Love2D

Post by TC1061 »

:( I'm trying to use LFS in the love2d 0.10.2, but it crashes!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests