Minetest 5.0.0 is on the road

User avatar
sorcerykid
Member
 
Posts: 835
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Minetest 5.0.0 is on the road

by sorcerykid » Thu Sep 13, 2018 12:15

If you are using dofile(), you don't need to resort to a global table. The following trick makes it possible to to share a truly protected namespace amongst all the included files in your mod :)

In init.lua, you pass the namespace as a parameter to the function returned by dofile()

Code: Select all
local this = {}

dofile(mod_path .. "/helpers.lua")(this)
dofile(mod_path .. "/tools.lua")(this)

And in the included file(s), you simply capture the namespace via a returned function.

Code: Select all
local this

local function bar(whatever)
  -- add functionality here
  this.foo()
end

return function (parent)
  this = parent
end

PS. If you're not averse to using loadfile() instead of dofile(), then the included files could be simplified even further

Code: Select all
local this = ...

local function bar(whatever)
  -- add functionality here
  this.foo()
end
 

User avatar
Beerholder
Member
 
Posts: 198
Joined: Wed Aug 03, 2016 20:23
GitHub: evrooije
In-game: Beerholder

Re: Minetest 5.0.0 is on the road

by Beerholder » Thu Sep 13, 2018 15:08

sorcerykid wrote:In init.lua, you pass the namespace as a parameter to the function returned by dofile()


I learned something new today O_o Thanks sk!! I think there are some places here and there where I could use this little trick :D
 

User avatar
PolySaken
Member
 
Posts: 258
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

Re: Minetest 5.0.0 is on the road

by PolySaken » Thu Sep 13, 2018 20:44

sorcerykid wrote:If you are using dofile(), you don't need to resort to a global table. The following trick makes it possible to to share a truly protected namespace amongst all the included files in your mod :)

In init.lua, you pass the namespace as a parameter to the function returned by dofile()

Code: Select all
local this = {}

dofile(mod_path .. "/helpers.lua")(this)
dofile(mod_path .. "/tools.lua")(this)

And in the included file(s), you simply capture the namespace via a returned function.

Code: Select all
local this

local function bar(whatever)
  -- add functionality here
  this.foo()
end

return function (parent)
  this = parent
end

PS. If you're not averse to using loadfile() instead of dofile(), then the included files could be simplified even further

Code: Select all
local this = ...

local function bar(whatever)
  -- add functionality here
  this.foo()
end

I did in fact know of this, but I wanted other mods to be able to interact with the global table as it has functions for creating new recipes for machines and also contains it's own settings object. I don't dislike the minetest settings object, but I prefer to use my own. This also allows me to have per-world settings (being added next), and you can change some of te settings while the game is running.
 

User avatar
Andrey01
Member
 
Posts: 2121
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: Minetest 5.0.0 is on the road

by Andrey01 » Fri Sep 21, 2018 11:37

Will MT 5.0.0 be released anywhere eventually? More one year of development is just wondering. And how many features/bugfixes are you going to make?
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

User avatar
Chiantos
Member
 
Posts: 190
Joined: Sun Jan 15, 2017 09:04
Location: Earth
GitHub: BlockColor
IRC: mrchiantos
In-game: mrchiantos

Re: Minetest 5.0.0 is on the road

by Chiantos » Fri Sep 21, 2018 14:56

Andrey01 wrote:Will MT 5.0.0 be released anywhere eventually? More one year of development is just wondering. And how many features/bugfixes are you going to make?


Quality takes time as an artist with a work or a craftsman with a piece of furniture, or a shoemaker with shoes. If it's to be fast as a Chinese factory with questionable quality and poor products. It's no use. Development takes time ... and often unpaid time.

Whether it is for engine developers, mods or games, it should not be forgotten that people also have a life. You are not a priority, there are things that are sometimes more important to manage, and this free time is often reduced.

You cant Wait 0.5 ? This is free and open. You can create so ...
Game : BlockColor - Avatar Mod with Cms : SkinKey
 

User avatar
Linuxdirk
Member
 
Posts: 1589
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Minetest 5.0.0 is on the road

by Linuxdirk » Fri Sep 21, 2018 15:47

Andrey01 wrote:Will MT 5.0.0 be released anywhere eventually? More one year of development is just wondering.

Not anytime soon. Personally I expect not before Q1/2019.

Andrey01 wrote:And how many features/bugfixes are you going to make?

https://dev.minetest.net/Changelog#0.4. ... eleased.29
 

User avatar
Andrey01
Member
 
Posts: 2121
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: Minetest 5.0.0 is on the road

by Andrey01 » Fri Sep 21, 2018 16:33

Andrey01 wrote:And how many features/bugfixes are you going to make?

https://dev.minetest.net/Changelog#0.4. ... eleased.29[/quote]
I mean how many features/bugfixes they have not released yet. There is what already released for 5.0.0 in that changelog.
DL9Eh7xVBw7DXwLAMX1lStE21bSD2XUQ
 

User avatar
Linuxdirk
Member
 
Posts: 1589
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Minetest 5.0.0 is on the road

by Linuxdirk » Fri Sep 21, 2018 17:04

Everything in the Changelog will come to 5.0.0, plus everything here at least: https://github.com/minetest/minetest/projects/4

But it feels like that currently no-one has time to work on this: https://github.com/minetest/minetest/pulse (ignore closed issues, most of them were just closed and did not result in any commits).
 

Previous

Return to News



Who is online

Users browsing this forum: No registered users and 0 guests