User Tools

Site Tools


data-types

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
Last revisionBoth sides next revision
data-types [2021/06/18 15:46] maximedata-types [2023/09/14 14:52] – [vec2i] polymorphgames
Line 11: Line 11:
 ---- ----
  
-==== integer ====+==== integer and unsigned integer ====
  
-Integer number+Integer number. Cannot be negative for unsigned integers.
  
 <file lua> <file lua>
Line 45: Line 45:
 <file lua> <file lua>
 local value = "String value" local value = "String value"
 +</file>
 +
 +----
 +
 +==== guid ====
 +
 +GUID are unique identifiers used to reference Assets or Game Objects. It can be interpreted from a string.
 +
 +<file lua>
 +local value = "645318b0-021a-4e02-9f91-bd18300e491a"
 </file> </file>
  
Line 57: Line 67:
 local value = { 54, 97 } local value = { 54, 97 }
 </file> </file>
 +
 +[[api:vec2i|Full vec2i api]].
  
 ---- ----
Line 79: Line 91:
 local value = { 19, 86, 45 } local value = { 19, 86, 45 }
 </file> </file>
 +
 +[[api:vec3i|Full vec3i api]].
  
 ---- ----
Line 84: Line 98:
 ==== vec3f ==== ==== vec3f ====
  
-3D float vector+3D float vector.
  
 To initialize a ''vec3f'' with ''x = -15.71'', ''y = -71'' and ''z = 93.03'': To initialize a ''vec3f'' with ''x = -15.71'', ''y = -71'' and ''z = 93.03'':
Line 90: Line 104:
 local value = { -15.71, -71.0, 93.03 } local value = { -15.71, -71.0, 93.03 }
 </file> </file>
 +
 +[[api:vec3f|Full vec3f api]].
  
 ---- ----
Line 103: Line 119:
  
 Quaternion properties can also be set with a ''vec3f'' containing the euler angles in degrees. Quaternion properties can also be set with a ''vec3f'' containing the euler angles in degrees.
 +
 +----
 +
 +==== matrix ====
 +
 +4x4 matrix representing a spatial transformation
 +
 +Matrices can be initialized with an array of 16 float numbers.
 +<file lua>
 +local value = {
 +    1, 0, 0, 0,
 +    0, 1, 0, 0,
 +    0, 0, 1, 0,
 +    0, 0, 0, 1
 +}
 +</file>
 +
 +Matrices can also be initialized with a dictionary containing three fields: ''Position'' (''vec3f''), ''Rotation'' (''quaternion'') and ''Scale'' (''vec3f''). All those fields are optional.
 +
 +<file lua>
 +local value = {
 +    Position = { 0, 0, 0 },
 +    Rotation = { 0, 0, 0 },
 +    Scale = { 1, 1, 1 } 
 +}
 +</file>
  
 ---- ----
Line 161: Line 203:
     GRASS_CLEAR = true     GRASS_CLEAR = true
 } }
 +</file>
 +
 +==== component type ====
 +
 +Type of a component, represented as a string
 +
 +<file lua>
 +local componentType = "COMP_BUILDING_PART"
 </file> </file>
  
Line 203: Line 253:
 mod:log(myClassInstance.MyStringArrayProperty[2]) -- logs the 2nd element of the list mod:log(myClassInstance.MyStringArrayProperty[2]) -- logs the 2nd element of the list
 </file> </file>
 +
 +An example of use can be found in the [[example-mods|Example 02 mod]], in the script file ''scripts/component/COMP_ANTENNA.lua''
  
 ==== fixed_sized_map ==== ==== fixed_sized_map ====
data-types.txt · Last modified: 2023/09/14 14:52 by polymorphgames

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki