mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Lua_api.txt: Naming convention for custom item/entity fields
Custom (non-engine) field names of items and entities are allowed. This is now documented in lua_api.txt. Field names beginning with an underscore are now reserved for mod use, the engine must not introduce any fields beginning with an underscore.
This commit is contained in:
parent
bc3980e1d6
commit
8e61c1dfd9
@ -3529,8 +3529,9 @@ Definition tables
|
||||
-- ^ Called sometimes; the string returned is passed to on_activate when
|
||||
-- the entity is re-activated from static state
|
||||
|
||||
-- Also you can define arbitrary member variables here
|
||||
myvariable = whatever,
|
||||
-- Also you can define arbitrary member variables here (see item definition for
|
||||
-- more info)
|
||||
_custom_field = whatever,
|
||||
}
|
||||
|
||||
### ABM (ActiveBlockModifier) definition (`register_abm`)
|
||||
@ -3646,6 +3647,12 @@ Definition tables
|
||||
end
|
||||
^ The user may be any ObjectRef or nil.
|
||||
]]
|
||||
_custom_field = whatever,
|
||||
--[[
|
||||
^ Add your own custom fields. By convention, all custom field names
|
||||
should start with `_` to avoid naming collisions with future engine
|
||||
usage.
|
||||
]]
|
||||
}
|
||||
|
||||
### Tile definition
|
||||
|
Loading…
Reference in New Issue
Block a user