How can I use Lua 5.2 for LOVE

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.
Croutonix
Prole
Posts: 34
Joined: Fri Aug 12, 2016 12:49 pm

How can I use Lua 5.2 for LOVE

Post by Croutonix »

I read somewhere that it was possible although I need to make my own build.
How do I do that? Will it be stable?
User avatar
AnRu
Citizen
Posts: 69
Joined: Sun Oct 27, 2013 1:33 pm
Contact:

Re: How can I use Lua 5.2 for LOVE

Post by AnRu »

You don't need to change source of Love2d to change Lua version. Lua is separated like other dependeces.
Follow build guide, but use lua headers and source files from 5.2 package.
Get ready for building conflicts, I don't know is Love2d source code is compatible with Lua 5.2
Last edited by AnRu on Wed Aug 17, 2016 4:58 pm, edited 1 time in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: How can I use Lua 5.2 for LOVE

Post by bartbes »

It's not tested regularly, but the LÖVE source should be compatible with lua 5.1, 5.2 and 5.3. Since we usually only test with 5.1 though, it's possible it no longer builds out-of-the-box, but I would consider that a bug.

EDIT: By the way, if you're compiling using autotools, give the --with-luaversion flag of configure a shot.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: How can I use Lua 5.2 for LOVE

Post by slime »

It's worth mentioning that LuaJIT (which LOVE uses by default) supports a few Lua 5.2 features out-of-the-box: http://luajit.org/extensions.html#lua52
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: How can I use Lua 5.2 for LOVE

Post by Inny »

If you're looking for the _ENV feature from lua 5.2, bear in mind that its behavior is very similar to setfenv, which is still available in lua 5.1 (ignoring the scope/function distinctions). You can use the following code snippit at the top of a module to give you the effect you're looking for:

Code: Select all

local _ENV = setmetatable({}, { __index = _ENV or _G })
if setfenv then setfenv(1, _ENV) end
Though the advice of "don't use it unless you need to" is pinned with it.
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: How can I use Lua 5.2 for LOVE

Post by pgimeno »

One way I've been using to run LÖVE with any Lua interpreter without recompiling anything, is to create a Lua file with this content:

Code: Select all

package.preload.love = package.loadlib('/path/liblove.so.0', 'luaopen_love')
require('boot')()
and run it with whatever interpreter you want to use, instead of running love. Unfortunately, for some reason it segfaults for me with Lua 5.2, though it works fine with 5.1 and LuaJIT.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: How can I use Lua 5.2 for LOVE

Post by Positive07 »

liblove or love.dll is dinamically linked to a dll called lua51.dll or liblua51.so, so it can't find that when using Lua 5.2 (or 5.3)

Why do you want to use 5.2 instead of 5.1? Are you aware that you will have to distribute your custom LÖVE version whenever you want to pass the game to someone else? Are you aware that binary module like the imgui one won't run without recompiling? Are you aware that LuaJIT is way faster than standard Lua?

You should have a really big motive to switch version
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Croutonix
Prole
Posts: 34
Joined: Fri Aug 12, 2016 12:49 pm

Re: How can I use Lua 5.2 for LOVE

Post by Croutonix »

There's a scripting app for iOS that uses Lua 5.2. It also comes with a draw library. I wanted to make an emulator to run my scripts on the computer, so I made one using Love. But I just realized some things like bit32 library are not included in Lua 5.1 which means some of my scripts don't work...
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: How can I use Lua 5.2 for LOVE

Post by slime »

LuaJIT has its own bit library: http://luajit.org/extensions.html#bit
Croutonix
Prole
Posts: 34
Joined: Fri Aug 12, 2016 12:49 pm

Re: How can I use Lua 5.2 for LOVE

Post by Croutonix »

I just need this?
local bit = require("bit")
Post Reply

Who is online

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