lua: minetest == core?

aristotle
Member
 
Posts: 48
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle

lua: minetest == core?

by aristotle » Wed Aug 22, 2018 08:03

First: I hope to have identified the right part of the forum to post this

When I read official docs such as lua_api.txt and code examples (eg other mods sources) I find reference to a core object.

MT 0.5 lua_api.txt lines 2009-2010, 2050-2051, 2059-2060
Code: Select all
* See also `minetest.explode_textlist_event`
  (main menu: `core.explode_textlist_event`).
...
* See also `minetest.explode_scrollbar_event`
  (main menu: `core.explode_scrollbar_event`).
...
* See also `minetest.explode_table_event`
  (main menu: `core.explode_table_event`).


What is this core object? Is this just an [old|deprecated] minetest alias or a completely different object? Is there a convention on its usage? Thank you in advance.
Happy builds & explorations!
 

User avatar
Krock
Developer
 
Posts: 4117
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: lua: minetest == core?

by Krock » Wed Aug 22, 2018 09:09

They're pointing both to the identical table: https://github.com/minetest/minetest/bl ... it.lua#L24 (i.e. "minetest" is identical to "core", always)

Use "minetest" for creating mods and "core" when you're working with Minetest's builtin code, which is: mainmenu, common helper functions, chat commands like /status and so on.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

aristotle
Member
 
Posts: 48
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle

Re: lua: minetest == core?

by aristotle » Wed Aug 22, 2018 10:02

Krock wrote:They're pointing both to the identical table: https://github.com/minetest/minetest/bl ... it.lua#L24 (i.e. "minetest" is identical to "core", always)

Use "minetest" for creating mods and "core" when you're working with Minetest's builtin code, which is: mainmenu, common helper functions, chat commands like /status and so on.

Thank you. It makes sense and helps code maintenance. :)
Happy builds & explorations!
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 3 guests