Skip to content

Commit 8e61c1d

Browse files
Wuzzyparamat
Wuzzy
authored andcommittedNov 15, 2016
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.
1 parent bc3980e commit 8e61c1d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

Diff for: ‎doc/lua_api.txt

+9-2
Original file line numberDiff line numberDiff line change
@@ -3529,8 +3529,9 @@ Definition tables
35293529
-- ^ Called sometimes; the string returned is passed to on_activate when
35303530
-- the entity is re-activated from static state
35313531

3532-
-- Also you can define arbitrary member variables here
3533-
myvariable = whatever,
3532+
-- Also you can define arbitrary member variables here (see item definition for
3533+
-- more info)
3534+
_custom_field = whatever,
35343535
}
35353536

35363537
### ABM (ActiveBlockModifier) definition (`register_abm`)
@@ -3646,6 +3647,12 @@ Definition tables
36463647
end
36473648
^ The user may be any ObjectRef or nil.
36483649
]]
3650+
_custom_field = whatever,
3651+
--[[
3652+
^ Add your own custom fields. By convention, all custom field names
3653+
should start with `_` to avoid naming collisions with future engine
3654+
usage.
3655+
]]
36493656
}
36503657

36513658
### Tile definition

0 commit comments

Comments
 (0)
Please sign in to comment.