Giter VIP home page Giter VIP logo

Comments (10)

slime73 avatar slime73 commented on May 22, 2024

Original comment by Bart van Strien (Bitbucket: bartbes, GitHub: bartbes).


Hmm, interesting...

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Robin Wellner (Bitbucket: gvx, GitHub: gvx).


So, here is a patch, to show how easy it would be:

diff -r 8c524628753e src/scripts/boot.lua
--- a/src/scripts/boot.lua	Sat Jun 26 19:10:58 2010 +0200
+++ b/src/scripts/boot.lua	Tue Jul 27 11:57:31 2010 +0200
@@ -246,13 +246,13 @@
 
 	-- If config file exists, load it and allow it to update config table.
 	if not love.conf and love.filesystem and love.filesystem.exists("conf.lua") then
-		require("conf.lua")
+		love.conf = setfenv(love.filesystem.load("conf.lua"), c)
 	end
 
 	-- Yes, conf.lua might not exist, but there are other ways of making
 	-- love.conf appear, so we should check for it anyway.
 	if love.conf then
-		local ok, err = pcall(love.conf, c)
+		local ok, err = pcall(love.conf)
 		if not ok then
 			print(err)
 			-- continue

The second change could even be left alone if you want.

Also, this doesn't check for errors in loading conf.lua, but then again, the previous version doesn't either.

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Bill Meltsner (Bitbucket: bmelts, GitHub: bmelts).


I don't know how forward-thinking we want to be here, but Lua 5.2 has deprecated setfenv, and assuming that we want to upgrade at some point, it might be prudent to try and figure out an alternative. Maybe.

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Bart van Strien (Bitbucket: bartbes, GitHub: bartbes).


It still has some form of function environments, forgot how to do it, but they're no going to remove the setfenv functionality.. I think.

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Robin Wellner (Bitbucket: gvx, GitHub: gvx).


IIRC 5.2 has the local _ENV for the environment, so it'll have to set that in some way.

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Robin Wellner (Bitbucket: gvx, GitHub: gvx).


Also, I think setfenv is kept in the debug library (which has to be required anyway for the error handler).

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Bart van Strien (Bitbucket: bartbes, GitHub: bartbes).


You'd remove some (as far as I know unused) functionality, and lose backwards-compatibility, so, what is the big gain here?

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Robin Wellner (Bitbucket: gvx, GitHub: gvx).


Simplicity and easy for lovers.

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Bart van Strien (Bitbucket: bartbes, GitHub: bartbes).


On IRC we came to conclusion that we'd leave it how it is. (or at least, I came to that conclusion :P)

from love.

slime73 avatar slime73 commented on May 22, 2024

Original comment by Luiji Maryo (Bitbucket: luiji, GitHub: luiji).


Could you please post more information onto why you came to this conclusion, Bartbes?

from love.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.