mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Use "core" namespace internally
This commit is contained in:
parent
1cd512913e
commit
c4359ff65c
45 changed files with 812 additions and 843 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue