User Tools

Site Tools


enumerations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
enumerations [2020/03/09 11:25] maximeenumerations [2021/03/09 08:10] (current) – fixed raycast minotorious
Line 1: Line 1:
 ====== Enumerations ====== ====== Enumerations ======
- 
-[[enumerations#Dynamic-enumerations|test]] 
  
 An enumeration (or enum) is a data type containing a set of constant values. An enumeration (or enum) is a data type containing a set of constant values.
Line 36: Line 34:
 -- C equivalent: (1 << OBJECT_FLAG.TERRAIN) | (1 << OBJECT_FLAG.WATER) | (1 << OBJECT_FLAG.PLATFORM) -- C equivalent: (1 << OBJECT_FLAG.TERRAIN) | (1 << OBJECT_FLAG.WATER) | (1 << OBJECT_FLAG.PLATFORM)
 local flag = bit.bor( local flag = bit.bor(
- bit.lshift(1, OBJECT_FLAG.TERRAIN), + bit.lshift(1, OBJECT_FLAG.TERRAIN:toNumber()), 
- bit.lshift(1, OBJECT_FLAG.WATER), + bit.lshift(1, OBJECT_FLAG.WATER:toNumber()), 
- bit.lshift(1, OBJECT_FLAG.PLATFORM)+ bit.lshift(1, OBJECT_FLAG.PLATFORM:toNumber())
 ) )
  
Line 48: Line 46:
  
 ===== Dynamic enumerations ===== ===== Dynamic enumerations =====
 +
 +For enumerations tagged as dynamic, you can add new values with the function ''registerEnumValue''. Multiple mods can register the same new enum value, which is then shared.
 +
 +You can find more information on the ''registerEnumValue'' on the [[:mod-management-functions#registerEnumValue|mod management function page]].
enumerations.1583767520.txt.gz · Last modified: 2020/03/09 11:25 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki