mirror of
https://github.com/minetest/minetest.git
synced 2024-12-28 00:47:29 +01:00
Add name field to registered entities
This commit is contained in:
parent
56f55ab1af
commit
ab57fbe4ca
@ -239,6 +239,7 @@
|
||||
--
|
||||
-- Registered entities:
|
||||
-- - Functions receive a "luaentity" as self:
|
||||
-- - It has the member .name, which is the registered name ("mod:thing")
|
||||
-- - It has the member .object, which is an ObjectRef pointing to the object
|
||||
-- - The original prototype stuff is visible directly via a metatable
|
||||
-- - Callbacks:
|
||||
|
@ -2652,6 +2652,10 @@ static int l_register_entity(lua_State *L)
|
||||
|
||||
// Get registered object to top of stack
|
||||
lua_pushvalue(L, 2);
|
||||
|
||||
// Set name field
|
||||
lua_pushvalue(L, 1);
|
||||
lua_setfield(L, -2, "name");
|
||||
|
||||
// Set __index to point to itself
|
||||
lua_pushvalue(L, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user