adding lua periphery library

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
Neb
Prole
Posts: 2
Joined: Fri Apr 17, 2020 12:27 pm

adding lua periphery library

Post by Neb » Mon May 11, 2020 9:17 am

Hello everyone !

So my project is to use our beloved LÖVE using as Raspberry Pi and Retroppie, and for the moment it has been a success :-)
Now I'm trying to use the pins of the raspberry pi with the lua-periphery

I got the .zip file, extracted it next to my main.lua

then in my love.load() :

Code: Select all

local GPIO = require('periphery').GPIO

    local gpio_out = GPIO("/dev/gpiochip0", 17, "out")
    gpio_out:write(false)
    gpio_out:close()
I'm developping on Win 10, and I understand that this library is linux based, so I'm aware that I should see some errors pop-up, but heres what I've got from the errors messages :
Error

main.lua:5: module 'periphery' not found:
no field package.preload['periphery']
no 'periphery' in LOVE game directories.
no file 'periphery' in LOVE paths.
no file '.\periphery.lua'
no file 'C:\Program Files\Love\lua\periphery.lua'
no file 'C:\Program Files\Love\lua\periphery\init.lua'
no file '.\periphery.dll'
no file 'C:\Program Files\Love\periphery.dll'
no file 'C:\Program Files\Love\loadall.dll'


Traceback

[C]: in function 'require'
main.lua:5: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
What I understand is that LÖVE don't find the module.
I've seen this this bits on the github documentation but I don't really understand it, and don't know if I have something to do in Windows to make it work :
Build and install from source

Clone lua-periphery recursively to also fetch c-periphery, which lua-periphery is built on.

$ git clone --recursive https://github.com/vsergeev/lua-periphery.git
$ cd lua-periphery
$ make clean all
$ cp periphery.so /path/to/lua/libs/

Place periphery.so in a directory searched by the Lua package.cpath variable. For example: /usr/lib/lua/5.3/, the same directory as other Lua sources, etc.

lua-periphery can then be loaded in lua with periphery = require('periphery').
Any idea of what I should do ?

Thanx !

User avatar
Karai17
Party member
Posts: 902
Joined: Sun Sep 02, 2012 10:46 pm

Re: adding lua periphery library

Post by Karai17 » Mon May 11, 2020 7:44 pm

You basically can't do this on Windows. You need to compile the C module on Linux and do other Linuxy things to get it working. This also seems to be built for Lua 5.3 and may no tbe compatible with LOVE (LuaJIT aka Lua 5.1 + some other stuff).
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

Neb
Prole
Posts: 2
Joined: Fri Apr 17, 2020 12:27 pm

Re: adding lua periphery library

Post by Neb » Tue May 12, 2020 12:19 pm

Alright ! Thank you for the tip ! Not a good news for me hehe

I managed to find someone who did a "Lua for Windows" installer (wich apparently run Lua5.1) with Luarocks library 2.0.2 on github, I'll try this solution.
And here's what the Github pages say for the lua-periphery module :
lua-periphery is compatible with Lua 5.1 (including LuaJIT), Lua 5.2, and Lua 5.3
I'll see if it works that way !

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 17 guests