aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-04-27 21:02:48 -0400
committerShadowNinja <shadowninja@minetest.net>2014-05-08 13:02:04 -0400
commitc4359ff65cd8e4e754442b9f2ef7051a8eaa4241 (patch)
treefeaad8be8c36cc4a0abdbe8d7b84db3ac68ed87e /src
parent1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528 (diff)
downloadminetest-c4359ff65cd8e4e754442b9f2ef7051a8eaa4241.tar.gz
minetest-c4359ff65cd8e4e754442b9f2ef7051a8eaa4241.tar.bz2
minetest-c4359ff65cd8e4e754442b9f2ef7051a8eaa4241.zip
Use "core" namespace internally
Diffstat (limited to 'src')
-rw-r--r--src/script/common/c_content.cpp8
-rw-r--r--src/script/common/c_internal.cpp4
-rw-r--r--src/script/cpp_api/s_async.cpp19
-rw-r--r--src/script/cpp_api/s_base.cpp28
-rw-r--r--src/script/cpp_api/s_entity.cpp26
-rw-r--r--src/script/cpp_api/s_env.cpp16
-rw-r--r--src/script/cpp_api/s_inventory.cpp4
-rw-r--r--src/script/cpp_api/s_item.cpp16
-rw-r--r--src/script/cpp_api/s_mainmenu.cpp8
-rw-r--r--src/script/cpp_api/s_player.cpp32
-rw-r--r--src/script/cpp_api/s_server.cpp10
-rw-r--r--src/script/lua_api/l_env.cpp86
-rw-r--r--src/script/lua_api/l_env.h68
-rw-r--r--src/script/lua_api/l_inventory.cpp2
-rw-r--r--src/script/lua_api/l_inventory.h2
-rw-r--r--src/script/lua_api/l_item.cpp6
-rw-r--r--src/script/lua_api/l_item.h2
-rw-r--r--src/script/lua_api/l_mapgen.cpp6
-rw-r--r--src/script/lua_api/l_mapgen.h6
-rw-r--r--src/script/lua_api/l_server.cpp2
-rw-r--r--src/script/lua_api/l_util.h5
-rw-r--r--src/script/scripting_game.cpp11
-rw-r--r--src/script/scripting_mainmenu.cpp10
23 files changed, 181 insertions, 196 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 2898d28ae..2f749043e 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -955,14 +955,14 @@ std::vector<ItemStack> read_items(lua_State *L, int index, Server *srv)
/******************************************************************************/
void luaentity_get(lua_State *L, u16 id)
{
- // Get minetest.luaentities[i]
- lua_getglobal(L, "minetest");
+ // Get luaentities[i]
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "luaentities");
luaL_checktype(L, -1, LUA_TTABLE);
lua_pushnumber(L, id);
lua_gettable(L, -2);
- lua_remove(L, -2); // luaentities
- lua_remove(L, -2); // minetest
+ lua_remove(L, -2); // Remove luaentities
+ lua_remove(L, -2); // Remove core
}
/******************************************************************************/
diff --git a/src/script/common/c_internal.cpp b/src/script/common/c_internal.cpp
index 4c6604f65..4c098f8d5 100644
--- a/src/script/common/c_internal.cpp
+++ b/src/script/common/c_internal.cpp
@@ -92,8 +92,8 @@ void script_run_callbacks(lua_State *L, int nargs, RunCallbacksMode mode)
int errorhandler = lua_gettop(L) - nargs - 1;
lua_insert(L, errorhandler);
- // Insert minetest.run_callbacks between error handler and table
- lua_getglobal(L, "minetest");
+ // Insert run_callbacks between error handler and table
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "run_callbacks");
lua_remove(L, -2);
lua_insert(L, errorhandler + 1);
diff --git a/src/script/cpp_api/s_async.cpp b/src/script/cpp_api/s_async.cpp
index 64260fb3a..0b19572c2 100644
--- a/src/script/cpp_api/s_async.cpp
+++ b/src/script/cpp_api/s_async.cpp
@@ -146,7 +146,7 @@ void AsyncEngine::putJobResult(LuaJobInfo result)
/******************************************************************************/
void AsyncEngine::step(lua_State *L, int errorhandler)
{
- lua_getglobal(L, "engine");
+ lua_getglobal(L, "core");
resultQueueMutex.Lock();
while (!resultQueue.empty()) {
LuaJobInfo jobDone = resultQueue.front();
@@ -169,7 +169,7 @@ void AsyncEngine::step(lua_State *L, int errorhandler)
}
}
resultQueueMutex.Unlock();
- lua_pop(L, 1); // Pop engine
+ lua_pop(L, 1); // Pop core
}
/******************************************************************************/
@@ -223,17 +223,10 @@ AsyncWorkerThread::AsyncWorkerThread(AsyncEngine* jobDispatcher,
{
lua_State *L = getStack();
- luaL_openlibs(L);
-
// Prepare job lua environment
- lua_newtable(L);
- lua_setglobal(L, "engine");
- lua_getglobal(L, "engine");
+ lua_getglobal(L, "core");
int top = lua_gettop(L);
- lua_pushstring(L, DIR_DELIM);
- lua_setglobal(L, "DIR_DELIM");
-
// Push builtin initialization type
lua_pushstring(L, "async");
lua_setglobal(L, "INIT");
@@ -278,9 +271,9 @@ void* AsyncWorkerThread::Thread()
continue;
}
- lua_getglobal(L, "engine");
+ lua_getglobal(L, "core");
if (lua_isnil(L, -1)) {
- errorstream << "Unable to find engine within async environment!";
+ errorstream << "Unable to find core within async environment!";
abort();
}
@@ -310,7 +303,7 @@ void* AsyncWorkerThread::Thread()
toProcess.serializedResult = std::string(retval, length);
}
- // Pop engine, job_processor, and retval
+ // Pop core, job_processor, and retval
lua_pop(L, 3);
// Put job result
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index 1a172fd31..d27506fbe 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_object.h"
#include "serverobject.h"
#include "debug.h"
+#include "filesys.h"
#include "log.h"
#include "mods.h"
#include "util/string.h"
@@ -48,13 +49,13 @@ public:
{
// Store current modname in registry
lua_pushstring(L, modname.c_str());
- lua_setfield(L, LUA_REGISTRYINDEX, "minetest_current_modname");
+ lua_setfield(L, LUA_REGISTRYINDEX, "current_modname");
}
~ModNameStorer()
{
// Clear current modname in registry
lua_pushnil(L);
- lua_setfield(L, LUA_REGISTRYINDEX, "minetest_current_modname");
+ lua_setfield(L, LUA_REGISTRYINDEX, "current_modname");
}
};
@@ -72,6 +73,8 @@ ScriptApiBase::ScriptApiBase()
m_luastack = luaL_newstate();
assert(m_luastack);
+ luaL_openlibs(m_luastack);
+
// Add and save an error handler
lua_pushcfunction(m_luastack, script_error_handler);
m_errorhandler = lua_gettop(m_luastack);
@@ -88,6 +91,13 @@ ScriptApiBase::ScriptApiBase()
lua_pop(m_luastack, 1);
#endif
+ // Add basic globals
+ lua_newtable(m_luastack);
+ lua_setglobal(m_luastack, "core");
+
+ lua_pushstring(m_luastack, DIR_DELIM);
+ lua_setglobal(m_luastack, "DIR_DELIM");
+
m_server = NULL;
m_environment = NULL;
m_guiengine = NULL;
@@ -191,8 +201,8 @@ void ScriptApiBase::addObjectReference(ServerActiveObject *cobj)
ObjectRef::create(L, cobj); // Puts ObjectRef (as userdata) on stack
int object = lua_gettop(L);
- // Get minetest.object_refs table
- lua_getglobal(L, "minetest");
+ // Get core.object_refs table
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "object_refs");
luaL_checktype(L, -1, LUA_TTABLE);
int objectstable = lua_gettop(L);
@@ -208,8 +218,8 @@ void ScriptApiBase::removeObjectReference(ServerActiveObject *cobj)
SCRIPTAPI_PRECHECKHEADER
//infostream<<"scriptapi_rm_object_reference: id="<<cobj->getId()<<std::endl;
- // Get minetest.object_refs table
- lua_getglobal(L, "minetest");
+ // Get core.object_refs table
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "object_refs");
luaL_checktype(L, -1, LUA_TTABLE);
int objectstable = lua_gettop(L);
@@ -244,12 +254,12 @@ void ScriptApiBase::objectrefGet(u16 id)
{
lua_State *L = getStack();
- // Get minetest.object_refs[i]
- lua_getglobal(L, "minetest");
+ // Get core.object_refs[i]
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "object_refs");
luaL_checktype(L, -1, LUA_TTABLE);
lua_pushnumber(L, id);
lua_gettable(L, -2);
lua_remove(L, -2); // object_refs
- lua_remove(L, -2); // minetest
+ lua_remove(L, -2); // core
}
diff --git a/src/script/cpp_api/s_entity.cpp b/src/script/cpp_api/s_entity.cpp
index 8e79f8838..ab8c6ee95 100644
--- a/src/script/cpp_api/s_entity.cpp
+++ b/src/script/cpp_api/s_entity.cpp
@@ -31,8 +31,8 @@ bool ScriptApiEntity::luaentity_Add(u16 id, const char *name)
verbosestream<<"scriptapi_luaentity_add: id="<<id<<" name=\""
<<name<<"\""<<std::endl;
- // Get minetest.registered_entities[name]
- lua_getglobal(L, "minetest");
+ // Get core.registered_entities[name]
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_entities");
luaL_checktype(L, -1, LUA_TTABLE);
lua_pushstring(L, name);
@@ -62,8 +62,8 @@ bool ScriptApiEntity::luaentity_Add(u16 id, const char *name)
luaL_typerror(L, -1, "ObjectRef");
lua_setfield(L, -2, "object");
- // minetest.luaentities[id] = object
- lua_getglobal(L, "minetest");
+ // core.luaentities[id] = object
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "luaentities");
luaL_checktype(L, -1, LUA_TTABLE);
lua_pushnumber(L, id); // Push id
@@ -80,7 +80,7 @@ void ScriptApiEntity::luaentity_Activate(u16 id,
verbosestream << "scriptapi_luaentity_activate: id=" << id << std::endl;
- // Get minetest.luaentities[id]
+ // Get core.luaentities[id]
luaentity_get(L, id);
int object = lua_gettop(L);
@@ -106,8 +106,8 @@ void ScriptApiEntity::luaentity_Remove(u16 id)
verbosestream << "scriptapi_luaentity_rm: id=" << id << std::endl;
- // Get minetest.luaentities table
- lua_getglobal(L, "minetest");
+ // Get core.luaentities table
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "luaentities");
luaL_checktype(L, -1, LUA_TTABLE);
int objectstable = lua_gettop(L);
@@ -117,7 +117,7 @@ void ScriptApiEntity::luaentity_Remove(u16 id)
lua_pushnil(L);
lua_settable(L, objectstable);
- lua_pop(L, 2); // pop luaentities, minetest
+ lua_pop(L, 2); // pop luaentities, core
}
std::string ScriptApiEntity::luaentity_GetStaticdata(u16 id)
@@ -126,7 +126,7 @@ std::string ScriptApiEntity::luaentity_GetStaticdata(u16 id)
//infostream<<"scriptapi_luaentity_get_staticdata: id="<<id<<std::endl;
- // Get minetest.luaentities[id]
+ // Get core.luaentities[id]
luaentity_get(L, id);
int object = lua_gettop(L);
@@ -157,7 +157,7 @@ void ScriptApiEntity::luaentity_GetProperties(u16 id,
//infostream<<"scriptapi_luaentity_get_properties: id="<<id<<std::endl;
- // Get minetest.luaentities[id]
+ // Get core.luaentities[id]
luaentity_get(L, id);
// Set default values that differ from ObjectProperties defaults
@@ -196,7 +196,7 @@ void ScriptApiEntity::luaentity_Step(u16 id, float dtime)
//infostream<<"scriptapi_luaentity_step: id="<<id<<std::endl;
- // Get minetest.luaentities[id]
+ // Get core.luaentities[id]
luaentity_get(L, id);
int object = lua_gettop(L);
// State: object is at top of stack
@@ -225,7 +225,7 @@ void ScriptApiEntity::luaentity_Punch(u16 id,
//infostream<<"scriptapi_luaentity_step: id="<<id<<std::endl;
- // Get minetest.luaentities[id]
+ // Get core.luaentities[id]
luaentity_get(L,id);
int object = lua_gettop(L);
// State: object is at top of stack
@@ -255,7 +255,7 @@ void ScriptApiEntity::luaentity_Rightclick(u16 id,
//infostream<<"scriptapi_luaentity_step: id="<<id<<std::endl;
- // Get minetest.luaentities[id]
+ // Get core.luaentities[id]
luaentity_get(L, id);
int object = lua_gettop(L);
// State: object is at top of stack
diff --git a/src/script/cpp_api/s_env.cpp b/src/script/cpp_api/s_env.cpp
index ee3783bb9..9ac9302ac 100644
--- a/src/script/cpp_api/s_env.cpp
+++ b/src/script/cpp_api/s_env.cpp
@@ -31,8 +31,8 @@ void ScriptApiEnv::environment_OnGenerated(v3s16 minp, v3s16 maxp,
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_generateds
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_generateds
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_generateds");
// Call callbacks
push_v3s16(L, minp);
@@ -46,8 +46,8 @@ void ScriptApiEnv::environment_Step(float dtime)
SCRIPTAPI_PRECHECKHEADER
//infostream<<"scriptapi_environment_step"<<std::endl;
- // Get minetest.registered_globalsteps
- lua_getglobal(L, "minetest");
+ // Get core.registered_globalsteps
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_globalsteps");
// Call callbacks
lua_pushnumber(L, dtime);
@@ -80,8 +80,8 @@ void ScriptApiEnv::environment_OnMapgenInit(MapgenParams *mgparams)
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_mapgen_inits
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_mapgen_inits
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_mapgen_inits");
// Call callbacks
@@ -114,8 +114,8 @@ void ScriptApiEnv::initializeEnvironment(ServerEnvironment *env)
Add ActiveBlockModifiers to environment
*/
- // Get minetest.registered_abms
- lua_getglobal(L, "minetest");
+ // Get core.registered_abms
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_abms");
luaL_checktype(L, -1, LUA_TTABLE);
int registered_abms = lua_gettop(L);
diff --git a/src/script/cpp_api/s_inventory.cpp b/src/script/cpp_api/s_inventory.cpp
index a2d186d00..f423a9f33 100644
--- a/src/script/cpp_api/s_inventory.cpp
+++ b/src/script/cpp_api/s_inventory.cpp
@@ -193,7 +193,7 @@ void ScriptApiDetached::detached_inventory_OnTake(
scriptError();
}
-// Retrieves minetest.detached_inventories[name][callbackname]
+// Retrieves core.detached_inventories[name][callbackname]
// If that is nil or on error, return false and stack is unchanged
// If that is a function, returns true and pushes the
// function onto the stack
@@ -202,7 +202,7 @@ bool ScriptApiDetached::getDetachedInventoryCallback(
{
lua_State *L = getStack();
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "detached_inventories");
lua_remove(L, -2);
luaL_checktype(L, -1, LUA_TTABLE);
diff --git a/src/script/cpp_api/s_item.cpp b/src/script/cpp_api/s_item.cpp
index cb5b1e775..ab82b6b47 100644
--- a/src/script/cpp_api/s_item.cpp
+++ b/src/script/cpp_api/s_item.cpp
@@ -112,7 +112,7 @@ bool ScriptApiItem::item_OnCraft(ItemStack &item, ServerActiveObject *user,
{
SCRIPTAPI_PRECHECKHEADER
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "on_craft");
LuaItemStack::create(L, item);
objectrefGetOrCreate(user);
@@ -143,7 +143,7 @@ bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user,
{
SCRIPTAPI_PRECHECKHEADER
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "craft_predict");
LuaItemStack::create(L, item);
objectrefGetOrCreate(user);
@@ -169,19 +169,19 @@ bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user,
return true;
}
-// Retrieves minetest.registered_items[name][callbackname]
+// Retrieves core.registered_items[name][callbackname]
// If that is nil or on error, return false and stack is unchanged
// If that is a function, returns true and pushes the
// function onto the stack
-// If minetest.registered_items[name] doesn't exist, minetest.nodedef_default
+// If core.registered_items[name] doesn't exist, core.nodedef_default
// is tried instead so unknown items can still be manipulated to some degree
bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname)
{
lua_State* L = getStack();
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_items");
- lua_remove(L, -2); // Remove minetest
+ lua_remove(L, -2); // Remove core
luaL_checktype(L, -1, LUA_TTABLE);
lua_getfield(L, -1, name);
lua_remove(L, -2); // Remove registered_items
@@ -192,8 +192,8 @@ bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname)
errorstream << "Item \"" << name << "\" not defined" << std::endl;
lua_pop(L, 1);
- // Try minetest.nodedef_default instead
- lua_getglobal(L, "minetest");
+ // Try core.nodedef_default instead
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "nodedef_default");
lua_remove(L, -2);
luaL_checktype(L, -1, LUA_TTABLE);
diff --git a/src/script/cpp_api/s_mainmenu.cpp b/src/script/cpp_api/s_mainmenu.cpp
index 62baeb406..ef8cea6c9 100644
--- a/src/script/cpp_api/s_mainmenu.cpp
+++ b/src/script/cpp_api/s_mainmenu.cpp
@@ -38,9 +38,9 @@ void ScriptApiMainMenu::handleMainMenuEvent(std::string text)
SCRIPTAPI_PRECHECKHEADER
// Get handler function
- lua_getglobal(L, "engine");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "event_handler");
- lua_remove(L, -2); // Remove engine
+ lua_remove(L, -2); // Remove core
if (lua_isnil(L, -1)) {
lua_pop(L, 1); // Pop event_handler
return;
@@ -58,9 +58,9 @@ void ScriptApiMainMenu::handleMainMenuButtons(std::map<std::string, std::string>
SCRIPTAPI_PRECHECKHEADER
// Get handler function
- lua_getglobal(L, "engine");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "button_handler");
- lua_remove(L, -2); // Remove engine
+ lua_remove(L, -2); // Remove core
if (lua_isnil(L, -1)) {
lua_pop(L, 1); // Pop button handler
return;
diff --git a/src/script/cpp_api/s_player.cpp b/src/script/cpp_api/s_player.cpp
index d357689f2..d7375082a 100644
--- a/src/script/cpp_api/s_player.cpp
+++ b/src/script/cpp_api/s_player.cpp
@@ -25,8 +25,8 @@ void ScriptApiPlayer::on_newplayer(ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_newplayers
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_newplayers
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_newplayers");
// Call callbacks
objectrefGetOrCreate(player);
@@ -37,8 +37,8 @@ void ScriptApiPlayer::on_dieplayer(ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_dieplayers
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_dieplayers
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_dieplayers");
// Call callbacks
objectrefGetOrCreate(player);
@@ -49,8 +49,8 @@ bool ScriptApiPlayer::on_respawnplayer(ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_respawnplayers
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_respawnplayers
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_respawnplayers");
// Call callbacks
objectrefGetOrCreate(player);
@@ -63,8 +63,8 @@ bool ScriptApiPlayer::on_prejoinplayer(std::string name, std::string ip, std::st
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_prejoinplayers
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_prejoinplayers
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_prejoinplayers");
lua_pushstring(L, name.c_str());
lua_pushstring(L, ip.c_str());
@@ -80,8 +80,8 @@ void ScriptApiPlayer::on_joinplayer(ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_joinplayers
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_joinplayers
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_joinplayers");
// Call callbacks
objectrefGetOrCreate(player);
@@ -92,8 +92,8 @@ void ScriptApiPlayer::on_leaveplayer(ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_leaveplayers
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_leaveplayers
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_leaveplayers");
// Call callbacks
objectrefGetOrCreate(player);
@@ -105,8 +105,8 @@ void ScriptApiPlayer::on_cheat(ServerActiveObject *player,
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_cheats
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_cheats
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_cheats");
// Call callbacks
objectrefGetOrCreate(player);
@@ -122,8 +122,8 @@ void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player,
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_chat_messages
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_chat_messages
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_player_receive_fields");
// Call callbacks
// param 1
diff --git a/src/script/cpp_api/s_server.cpp b/src/script/cpp_api/s_server.cpp
index 7d21f968b..21fe164aa 100644
--- a/src/script/cpp_api/s_server.cpp
+++ b/src/script/cpp_api/s_server.cpp
@@ -62,13 +62,13 @@ void ScriptApiServer::getAuthHandler()
{
lua_State *L = getStack();
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_auth_handler");
if (lua_isnil(L, -1)){
lua_pop(L, 1);
lua_getfield(L, -1, "builtin_auth_handler");
}
- lua_remove(L, -2); // Remove minetest
+ lua_remove(L, -2); // Remove core
if (lua_type(L, -1) != LUA_TTABLE)
throw LuaError("Authentication handler table not valid");
}
@@ -130,8 +130,8 @@ bool ScriptApiServer::on_chat_message(const std::string &name,
{
SCRIPTAPI_PRECHECKHEADER
- // Get minetest.registered_on_chat_messages
- lua_getglobal(L, "minetest");
+ // Get core.registered_on_chat_messages
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_chat_messages");
// Call callbacks
lua_pushstring(L, name.c_str());
@@ -146,7 +146,7 @@ void ScriptApiServer::on_shutdown()
SCRIPTAPI_PRECHECKHEADER
// Get registered shutdown hooks
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_shutdown");
// Call callbacks
script_run_callbacks(L, 0, RUN_CALLBACKS_MODE_FIRST);
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 37fa167e6..42bfc4beb 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -56,24 +56,24 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
lua_pushcfunction(L, script_error_handler);
int errorhandler = lua_gettop(L);
- // Get minetest.registered_abms
- lua_getglobal(L, "minetest");
+ // Get registered_abms
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_abms");
luaL_checktype(L, -1, LUA_TTABLE);
- lua_remove(L, -2); // Remove "minetest"
+ lua_remove(L, -2); // Remove core
- // Get minetest.registered_abms[m_id]
+ // Get registered_abms[m_id]
lua_pushnumber(L, m_id);
lua_gettable(L, -2);
if(lua_isnil(L, -1))
assert(0);
- lua_remove(L, -2); // Remove "registered_abms"
+ lua_remove(L, -2); // Remove registered_abms
// Call action
luaL_checktype(L, -1, LUA_TTABLE);
lua_getfield(L, -1, "action");
luaL_checktype(L, -1, LUA_TFUNCTION);
- lua_remove(L, -2); // Remove "registered_abms[m_id]"
+ lua_remove(L, -2); // Remove registered_abms[m_id]
push_v3s16(L, p);
pushnode(L, n, env->getGameDef()->ndef());
lua_pushnumber(L, active_object_count);
@@ -85,7 +85,7 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
// Exported functions
-// minetest.set_node(pos, node)
+// set_node(pos, node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_set_node(lua_State *L)
{
@@ -106,7 +106,7 @@ int ModApiEnvMod::l_add_node(lua_State *L)
return l_set_node(L);
}
-// minetest.remove_node(pos)
+// remove_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_remove_node(lua_State *L)
{
@@ -120,7 +120,7 @@ int ModApiEnvMod::l_remove_node(lua_State *L)
return 1;
}
-// minetest.swap_node(pos, node)
+// swap_node(pos, node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_swap_node(lua_State *L)
{
@@ -136,7 +136,7 @@ int ModApiEnvMod::l_swap_node(lua_State *L)
return 1;
}
-// minetest.get_node(pos)
+// get_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node(lua_State *L)
{
@@ -151,7 +151,7 @@ int ModApiEnvMod::l_get_node(lua_State *L)
return 1;
}
-// minetest.get_node_or_nil(pos)
+// get_node_or_nil(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node_or_nil(lua_State *L)
{
@@ -172,7 +172,7 @@ int ModApiEnvMod::l_get_node_or_nil(lua_State *L)
}
}
-// minetest.get_node_light(pos, timeofday)
+// get_node_light(pos, timeofday)
// pos = {x=num, y=num, z=num}
// timeofday: nil = current time, 0 = night, 0.5 = day
int ModApiEnvMod::l_get_node_light(lua_State *L)
@@ -198,7 +198,7 @@ int ModApiEnvMod::l_get_node_light(lua_State *L)
}
}
-// minetest.place_node(pos, node)
+// place_node(pos, node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_place_node(lua_State *L)
{
@@ -232,7 +232,7 @@ int ModApiEnvMod::l_place_node(lua_State *L)
return 1;
}
-// minetest.dig_node(pos)
+// dig_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_dig_node(lua_State *L)
{
@@ -255,7 +255,7 @@ int ModApiEnvMod::l_dig_node(lua_State *L)
return 1;
}
-// minetest.punch_node(pos)
+// punch_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_punch_node(lua_State *L)
{
@@ -278,7 +278,7 @@ int ModApiEnvMod::l_punch_node(lua_State *L)
return 1;
}
-// minetest.get_node_max_level(pos)
+// get_node_max_level(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node_max_level(lua_State *L)
{
@@ -290,7 +290,7 @@ int ModApiEnvMod::l_get_node_max_level(lua_State *L)
return 1;
}
-// minetest.get_node_level(pos)
+// get_node_level(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node_level(lua_State *L)
{
@@ -302,7 +302,7 @@ int ModApiEnvMod::l_get_node_level(lua_State *L)
return 1;
}
-// minetest.set_node_level(pos, level)
+// set_node_level(pos, level)
// pos = {x=num, y=num, z=num}
// level: 0..63
int ModApiEnvMod::l_set_node_level(lua_State *L)
@@ -319,7 +319,7 @@ int ModApiEnvMod::l_set_node_level(lua_State *L)
return 1;
}
-// minetest.add_node_level(pos, level)
+// add_node_level(pos, level)
// pos = {x=num, y=num, z=num}
// level: 0..63
int ModApiEnvMod::l_add_node_level(lua_State *L)
@@ -337,7 +337,7 @@ int ModApiEnvMod::l_add_node_level(lua_State *L)
}
-// minetest.get_meta(pos)
+// get_meta(pos)
int ModApiEnvMod::l_get_meta(lua_State *L)
{
GET_ENV_PTR;
@@ -348,7 +348,7 @@ int ModApiEnvMod::l_get_meta(lua_State *L)
return 1;
}
-// minetest.get_node_timer(pos)
+// get_node_timer(pos)
int ModApiEnvMod::l_get_node_timer(lua_State *L)
{
GET_ENV_PTR;
@@ -359,7 +359,7 @@ int ModApiEnvMod::l_get_node_timer(lua_State *L)
return 1;
}
-// minetest.add_entity(pos, entityname) -> ObjectRef or nil
+// add_entity(pos, entityname) -> ObjectRef or nil
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_add_entity(lua_State *L)
{
@@ -380,7 +380,7 @@ int ModApiEnvMod::l_add_entity(lua_State *L)
return 1;
}
-// minetest.add_item(pos, itemstack or itemstring or table) -> ObjectRef or nil
+// add_item(pos, itemstack or itemstring or table) -> ObjectRef or nil
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_add_item(lua_State *L)
{
@@ -396,10 +396,10 @@ int ModApiEnvMod::l_add_item(lua_State *L)
lua_pushcfunction(L, script_error_handler);
int errorhandler = lua_gettop(L);
- // Use minetest.spawn_item to spawn a __builtin:item
- lua_getglobal(L, "minetest");
+ // Use spawn_item to spawn a __builtin:item
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "spawn_item");
- lua_remove(L, -2); // Remove minetest
+ lua_remove(L, -2); // Remove core
if(lua_isnil(L, -1))
return 0;
lua_pushvalue(L, 1);
@@ -423,7 +423,7 @@ int ModApiEnvMod::l_add_item(lua_State *L)
return 1;*/
}
-// minetest.get_player_by_name(name)
+// get_player_by_name(name)
int ModApiEnvMod::l_get_player_by_name(lua_State *L)
{
GET_ENV_PTR;
@@ -445,7 +445,7 @@ int ModApiEnvMod::l_get_player_by_name(lua_State *L)
return 1;
}
-// minetest.get_objects_inside_radius(pos, radius)
+// get_objects_inside_radius(pos, radius)
int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L)
{
GET_ENV_PTR;
@@ -466,7 +466,7 @@ int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L)
return 1;
}
-// minetest.set_timeofday(val)
+// set_timeofday(val)
// val = 0...1
int ModApiEnvMod::l_set_timeofday(lua_State *L)
{
@@ -484,7 +484,7 @@ int ModApiEnvMod::l_set_timeofday(lua_State *L)
return 0;
}
-// minetest.get_timeofday() -> 0...1
+// get_timeofday() -> 0...1
int ModApiEnvMod::l_get_timeofday(lua_State *L)
{
GET_ENV_PTR;
@@ -496,7 +496,7 @@ int ModApiEnvMod::l_get_timeofday(lua_State *L)
return 1;
}
-// minetest.get_gametime()
+// get_gametime()
int ModApiEnvMod::l_get_gametime(lua_State *L)
{
GET_ENV_PTR;
@@ -507,7 +507,7 @@ int ModApiEnvMod::l_get_gametime(lua_State *L)
}
-// minetest.find_node_near(pos, radius, nodenames) -> pos or nil
+// find_node_near(pos, radius, nodenames) -> pos or nil
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
int ModApiEnvMod::l_find_node_near(lua_State *L)
{
@@ -547,7 +547,7 @@ int ModApiEnvMod::l_find_node_near(lua_State *L)
return 0;
}
-// minetest.find_nodes_in_area(minp, maxp, nodenames) -> list of positions
+// find_nodes_in_area(minp, maxp, nodenames) -> list of positions
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
int ModApiEnvMod::l_find_nodes_in_area(lua_State *L)
{
@@ -586,7 +586,7 @@ int ModApiEnvMod::l_find_nodes_in_area(lua_State *L)
return 1;
}
-// minetest.get_perlin(seeddiff, octaves, persistence, scale)
+// get_perlin(seeddiff, octaves, persistence, scale)
// returns world-specific PerlinNoise
int ModApiEnvMod::l_get_perlin(lua_State *L)
{
@@ -604,7 +604,7 @@ int ModApiEnvMod::l_get_perlin(lua_State *L)
return 1;
}
-// minetest.get_perlin_map(noiseparams, size)
+// get_perlin_map(noiseparams, size)
// returns world-specific PerlinNoiseMap
int ModApiEnvMod::l_get_perlin_map(lua_State *L)
{
@@ -623,7 +623,7 @@ int ModApiEnvMod::l_get_perlin_map(lua_State *L)
return 1;
}
-// minetest.get_voxel_manip()
+// get_voxel_manip()
// returns voxel manipulator
int ModApiEnvMod::l_get_voxel_manip(lua_State *L)
{
@@ -638,7 +638,7 @@ int ModApiEnvMod::l_get_voxel_manip(lua_State *L)
return 1;
}
-// minetest.clear_objects()
+// clear_objects()
// clear all objects in the environment
int ModApiEnvMod::l_clear_objects(lua_State *L)
{
@@ -648,7 +648,7 @@ int ModApiEnvMod::l_clear_objects(lua_State *L)
return 0;
}
-// minetest.line_of_sight(pos1, pos2, stepsize) -> true/false, pos
+// line_of_sight(pos1, pos2, stepsize) -> true/false, pos
int ModApiEnvMod::l_line_of_sight(lua_State *L) {
float stepsize = 1.0;
@@ -673,7 +673,7 @@ int ModApiEnvMod::l_line_of_sight(lua_State *L) {
return 1;
}
-// minetest.find_path(pos1, pos2, searchdistance,
+// find_path(pos1, pos2, searchdistance,
// max_jump, max_drop, algorithm) -> table containing path
int ModApiEnvMod::l_find_path(lua_State *L)
{
@@ -716,7 +716,7 @@ int ModApiEnvMod::l_find_path(lua_State *L)
return 0;
}
-// minetest.spawn_tree(pos, treedef)
+// spawn_tree(pos, treedef)
int ModApiEnvMod::l_spawn_tree(lua_State *L)
{
GET_ENV_PTR;
@@ -765,7 +765,7 @@ int ModApiEnvMod::l_spawn_tree(lua_State *L)
return 1;
}
-// minetest.transforming_liquid_add(pos)
+// transforming_liquid_add(pos)
int ModApiEnvMod::l_transforming_liquid_add(lua_State *L)
{
GET_ENV_PTR;
@@ -775,7 +775,7 @@ int ModApiEnvMod::l_transforming_liquid_add(lua_State *L)
return 1;
}
-// minetest.forceload_block(blockpos)
+// forceload_block(blockpos)
// blockpos = {x=num, y=num, z=num}
int ModApiEnvMod::l_forceload_block(lua_State *L)
{
@@ -786,7 +786,7 @@ int ModApiEnvMod::l_forceload_block(lua_State *L)
return 0;
}
-// minetest.forceload_free_block(blockpos)
+// forceload_free_block(blockpos)
// blockpos = {x=num, y=num, z=num}
int ModApiEnvMod::l_forceload_free_block(lua_State *L)
{
diff --git a/src/script/lua_api/l_env.h b/src/script/lua_api/l_env.h
index 8bf599b0c..420866d5d 100644
--- a/src/script/lua_api/l_env.h
+++ b/src/script/lua_api/l_env.h
@@ -25,134 +25,134 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class ModApiEnvMod : public ModApiBase {
private:
- // minetest.set_node(pos, node)
+ // set_node(pos, node)
// pos = {x=num, y=num, z=num}
static int l_set_node(lua_State *L);
static int l_add_node(lua_State *L);
- // minetest.remove_node(pos)
+ // remove_node(pos)
// pos = {x=num, y=num, z=num}
static int l_remove_node(lua_State *L);
- // minetest.swap_node(pos, node)
+ // swap_node(pos, node)
// pos = {x=num, y=num, z=num}
static int l_swap_node(lua_State *L);
- // minetest.get_node(pos)
+ // get_node(pos)
// pos = {x=num, y=num, z=num}
static int l_get_node(lua_State *L);
- // minetest.get_node_or_nil(pos)
+ // get_node_or_nil(pos)
// pos = {x=num, y=num, z=num}
static int l_get_node_or_nil(lua_State *L);
- // minetest.get_node_light(pos, timeofday)
+ // get_node_light(pos, timeofday)
// pos = {x=num, y=num, z=num}
// timeofday: nil = current time, 0 = night, 0.5 = day
static int l_get_node_light(lua_State *L);
- // minetest.place_node(pos, node)
+ // place_node(pos, node)
// pos = {x=num, y=num, z=num}
static int l_place_node(lua_State *L);
- // minetest.dig_node(pos)
+ // dig_node(pos)
// pos = {x=num, y=num, z=num}
static int l_dig_node(lua_State *L);
- // minetest.punch_node(pos)
+ // punch_node(pos)
// pos = {x=num, y=num, z=num}
static int l_punch_node(lua_State *L);
- // minetest.get_node_max_level(pos)
+ // get_node_max_level(pos)
// pos = {x=num, y=num, z=num}
static int l_get_node_max_level(lua_State *L);
- // minetest.get_node_level(pos)
+ // get_node_level(pos)
// pos = {x=num, y=num, z=num}
static int l_get_node_level(lua_State *L);
- // minetest.set_node_level(pos)
+ // set_node_level(pos)
// pos = {x=num, y=num, z=num}
static int l_set_node_level(lua_State *L);
- // minetest.add_node_level(pos)
+ // add_node_level(pos)
// pos = {x=num, y=num, z=num}
static int l_add_node_level(lua_State *L);
- // minetest.get_meta(pos)
+ // get_meta(pos)
static int l_get_meta(lua_State *L);
- // minetest.get_node_timer(pos)
+ // get_node_timer(pos)
static int l_get_node_timer(lua_State *L);
- // minetest.add_entity(pos, entityname) -> ObjectRef or nil
+ // add_entity(pos, entityname) -> ObjectRef or nil
// pos = {x=num, y=num, z=num}
static int l_add_entity(lua_State *L);
- // minetest.add_item(pos, itemstack or itemstring or table) -> ObjectRef or nil
+ // add_item(pos, itemstack or itemstring or table) -> ObjectRef or nil
// pos = {x=num, y=num, z=num}
static int l_add_item(lua_State *L);
- // minetest.get_player_by_name(name)
+ // get_player_by_name(name)
static int l_get_player_by_name(lua_State *L);
- // minetest.get_objects_inside_radius(pos, radius)
+ // get_objects_inside_radius(pos, radius)
static int l_get_objects_inside_radius(lua_State *L);
- // minetest.set_timeofday(val)
+ // set_timeofday(val)
// val = 0...1
static int l_set_timeofday(lua_State *L);
- // minetest.get_timeofday() -> 0...1
+ // get_timeofday() -> 0...1
static int l_get_timeofday(lua_State *L);
- // minetest.get_gametime()
+ // get_gametime()
static int l_get_gametime(lua_State *L);
- // minetest.find_node_near(pos, radius, nodenames) -> pos or nil
+ // find_node_near(pos, radius, nodenames) -> pos or nil
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_node_near(lua_State *L);
- // minetest.find_nodes_in_area(minp, maxp, nodenames) -> list of positions
+ // find_nodes_in_area(minp, maxp, nodenames) -> list of positions
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_nodes_in_area(lua_State *L);
- // minetest.get_perlin(seeddiff, octaves, persistence, scale)
+ // get_perlin(seeddiff, octaves, persistence, scale)
// returns world-specific PerlinNoise
static int l_get_perlin(lua_State *L);
- // minetest.get_perlin_map(noiseparams, size)
+ // get_perlin_map(noiseparams, size)
// returns world-specific PerlinNoiseMap
static int l_get_perlin_map(lua_State *L);
- // minetest.get_voxel_manip()
+ // get_voxel_manip()
// returns world-specific voxel manipulator
static int l_get_voxel_manip(lua_State *L);
- // minetest.clear_objects()
+ // clear_objects()
// clear all objects in the environment
static int l_clear_objects(lua_State *L);
- // minetest.spawn_tree(pos, treedef)
+ // spawn_tree(pos, treedef)
static int l_spawn_tree(lua_State *L);
- // minetest.line_of_sight(pos1, pos2, stepsize) -> true/false
+ // line_of_sight(pos1, pos2, stepsize) -> true/false
static int l_line_of_sight(lua_State *L);
- // minetest.find_path(pos1, pos2, searchdistance,
+ // find_path(pos1, pos2, searchdistance,
// max_jump, max_drop, algorithm) -> table containing path
static int l_find_path(lua_State *L);
- // minetest.transforming_liquid_add(pos)
+ // transforming_liquid_add(pos)
static int l_transforming_liquid_add(lua_State *L);
- // minetest.forceload_block(blockpos)
+ // forceload_block(blockpos)
// forceloads a block
static int l_forceload_block(lua_State *L);
- // minetest.forceload_free_block(blockpos)
+ // forceload_free_block(blockpos)
// stops forceloading a position
static int l_forceload_free_block(lua_State *L);
diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp
index aef011da3..a45ae5168 100644
--- a/src/script/lua_api/l_inventory.cpp
+++ b/src/script/lua_api/l_inventory.cpp
@@ -361,7 +361,7 @@ int InvRef::l_remove_item(lua_State *L)
return 1;
}
-// get_location() -> location (like minetest.get_inventory(location))
+// get_location() -> location (like get_inventory(location))
int InvRef::l_get_location(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
diff --git a/src/script/lua_api/l_inventory.h b/src/script/lua_api/l_inventory.h
index 03b241034..2d4b29d0c 100644
--- a/src/script/lua_api/l_inventory.h
+++ b/src/script/lua_api/l_inventory.h
@@ -101,7 +101,7 @@ private:
// Returns the items that were actually removed
static int l_remove_item(lua_State *L);
- // get_location() -> location (like minetest.get_inventory(location))
+ // get_location() -> location (like get_inventory(location))
static int l_get_location(lua_State *L);
public:
diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp
index 094d0bb25..bc6a8ecde 100644
--- a/src/script/lua_api/l_item.cpp
+++ b/src/script/lua_api/l_item.cpp
@@ -234,7 +234,7 @@ int LuaItemStack::l_is_known(lua_State *L)
}
// get_definition(self) -> table
-// Returns the item definition table from minetest.registered_items,
+// Returns the item definition table from registered_items,
// or a fallback one (name="unknown")
int LuaItemStack::l_get_definition(lua_State *L)
{
@@ -242,8 +242,8 @@ int LuaItemStack::l_get_definition(lua_State *L)
LuaItemStack *o = checkobject(L, 1);
ItemStack &item = o->m_stack;
- // Get minetest.registered_items[name]
- lua_getglobal(L, "minetest");
+ // Get registered_items[name]
+ lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_items");
luaL_checktype(L, -1, LUA_TTABLE);
lua_getfield(L, -1, item.name.c_str());
diff --git a/src/script/lua_api/l_item.h b/src/script/lua_api/l_item.h
index 7f5a1130d..0f9e4ba9b 100644
--- a/src/script/lua_api/l_item.h
+++ b/src/script/lua_api/l_item.h
@@ -85,7 +85,7 @@ private:
static int l_is_known(lua_State *L);
// get_definition(self) -> table
- // Returns the item definition table from minetest.registered_items,
+ // Returns the item definition table from core.registered_items,
// or a fallback one (name="unknown")
static int l_get_definition(lua_State *L);
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index 9fbb46ee1..287faade9 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -78,7 +78,7 @@ struct EnumString ModApiMapgen::es_Rotation[] =
};
-// minetest.get_mapgen_object(objectname)
+// get_mapgen_object(objectname)
// returns the requested object used during map generation
int ModApiMapgen::l_get_mapgen_object(lua_State *L)
{
@@ -181,7 +181,7 @@ int ModApiMapgen::l_get_mapgen_object(lua_State *L)
return 0;
}
-// minetest.set_mapgen_params(params)
+// set_mapgen_params(params)
// set mapgen parameters
int ModApiMapgen::l_set_mapgen_params(lua_State *L)
{
@@ -225,7 +225,7 @@ int ModApiMapgen::l_set_mapgen_params(lua_State *L)
return 0;
}
-// minetest.set_noiseparam_defaults({np1={noise params}, ...})
+// set_noiseparam_defaults({np1={noise params}, ...})
// set default values for noise parameters if not present in global settings
int ModApiMapgen::l_set_noiseparam_defaults(lua_State *L)
{
diff --git a/src/script/lua_api/l_mapgen.h b/src/script/lua_api/l_mapgen.h
index 8624f9775..8ffe32893 100644
--- a/src/script/lua_api/l_mapgen.h
+++ b/src/script/lua_api/l_mapgen.h
@@ -24,15 +24,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class ModApiMapgen : public ModApiBase {
private:
- // minetest.get_mapgen_object(objectname)
+ // get_mapgen_object(objectname)
// returns the requested object used during map generation
static int l_get_mapgen_object(lua_State *L);
- // minetest.set_mapgen_params(params)
+ // set_mapgen_params(params)
// set mapgen parameters
static int l_set_mapgen_params(lua_State *L);
- // minetest.set_noiseparam_defaults({np1={noise params}, ...})
+ // set_noiseparam_defaults({np1={noise params}, ...})
static int l_set_noiseparam_defaults(lua_State *L);
// set_gen_notify(flagstring)
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index 7770a5ff4..76fe439eb 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
@@ -341,7 +341,7 @@ int ModApiServer::l_show_formspec(lua_State *L)
int ModApiServer::l_get_current_modname(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
- lua_getfield(L, LUA_REGISTRYINDEX, "minetest_current_modname");
+ lua_getfield(L, LUA_REGISTRYINDEX, "current_modname");
return 1;
}
diff --git a/src/script/lua_api/l_util.h b/src/script/lua_api/l_util.h
index d72978dc6..cfdeea1e8 100644
--- a/src/script/lua_api/l_util.h
+++ b/src/script/lua_api/l_util.h
@@ -28,9 +28,8 @@ class ModApiUtil : public ModApiBase {
private:
/*
NOTE:
- The functions in this module are available through
- minetest.<function> in the in-game API as well as
- engine.<function> in the mainmenu API
+ The functions in this module are available in the in-game API
+ as well as in the mainmenu API.
All functions that don't require either a Server or
GUIEngine instance should be in here.
diff --git a/src/script/scripting_game.cpp b/src/script/scripting_game.cpp
index fccd10722..e716bc979 100644
--- a/src/script/scripting_game.cpp
+++ b/src/script/scripting_game.cpp
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "scripting_game.h"
#include "server.h"
-#include "filesys.h"
#include "log.h"
#include "cpp_api/s_internal.h"
#include "lua_api/l_base.h"
@@ -52,17 +51,9 @@ GameScripting::GameScripting(Server* server)
//TODO add security
- luaL_openlibs(getStack());
-
SCRIPTAPI_PRECHECKHEADER
- lua_pushstring(L, DIR_DELIM);
- lua_setglobal(L, "DIR_DELIM");
-
- // Create the main minetest table
- lua_newtable(L);
- lua_setglobal(L, "minetest");
- lua_getglobal(L, "minetest");
+ lua_getglobal(L, "core");
int top = lua_gettop(L);
lua_newtable(L);
diff --git a/src/script/scripting_mainmenu.cpp b/src/script/scripting_mainmenu.cpp
index 9afddd156..54b3133c5 100644
--- a/src/script/scripting_mainmenu.cpp
+++ b/src/script/scripting_mainmenu.cpp
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mods.h"
#include "porting.h"
#include "log.h"
-#include "filesys.h"
#include "cpp_api/s_internal.h"
#include "lua_api/l_base.h"
#include "lua_api/l_mainmenu.h"
@@ -41,18 +40,11 @@ MainMenuScripting::MainMenuScripting(GUIEngine* guiengine)
//TODO add security
- luaL_openlibs(getStack());
-
SCRIPTAPI_PRECHECKHEADER
- lua_newtable(L);
- lua_setglobal(L, "engine");
- lua_getglobal(L, "engine");
+ lua_getglobal(L, "core");
int top = lua_gettop(L);
- lua_pushstring(L, DIR_DELIM);
- lua_setglobal(L, "DIR_DELIM");
-
lua_newtable(L);
lua_setglobal(L, "gamedata");