- Code: Select all
['UNIT_228'] = {
type = 'urb2101',
orders = '',
platoon = '',
Position = { 23.500000, 37.507813, 249.500000 },
Orientation = { 0.000000, -3.141593, 0.000000 }
}
An entry for a marker like this:
- Code: Select all
['Mass 16'] = {
['size'] = FLOAT( 1.000000 ),
['resource'] = BOOLEAN( true ),
['amount'] = FLOAT( 100.000000 ),
['color'] = STRING( 'ff808080' ),
['editorIcon'] = STRING( '/textures/editor/marker_mass.bmp' ),
['type'] = STRING( 'Mass' ),
['prop'] = STRING( '/env/common/props/markers/M_Mass_prop.bp' ),
['orientation'] = VECTOR3( 0, -0, 0 ),
['position'] = VECTOR3( 309.5, 28.2969, 347.5 )
}
Lets strip these down a bit:
- Code: Select all
['UNIT_228'] = {
Position = { 23.500000, 37.507813, 249.500000 },
Orientation = { 0.000000, -3.141593, 0.000000 }
}
- Code: Select all
['Mass 16'] = {
['orientation'] = VECTOR3( 0, -0, 0 ),
['position'] = VECTOR3( 309.5, 28.2969, 347.5 )
}
Better. Now consider the definition for `VECTOR3`:
- Code: Select all
function VECTOR3(x, y, z)
return {x, y, z}
end
It returns just a table so
- Code: Select all
['position'] = VECTOR3( 309.5, 28.2969, 347.5 )
is in fact the same as
- Code: Select all
['position'] = { 309.5, 28.2969, 347.5 }
which is the same format as in the table for the `UNIT_228`.
Also note that `{['key'] = 1}` is the same as `{key = 1}`. (In the context of the brace syntax undecorated tokens are interpreted as strings.)
Okay so when we combine these our entries for the unit and the marker actually turn out as:
- Code: Select all
['UNIT_228'] = {
Position = { 23.500000, 37.507813, 249.500000 },
Orientation = { 0.000000, -3.141593, 0.000000 }
}
- Code: Select all
['Mass 16'] = {
orientation = { 0, -0, 0 },
position = { 309.5, 28.2969, 347.5 }
}
So, why the hell use that unnecessary vector function and why use different syntaxes for defining keys. And primarily: Why use capitalised keys in the one case and all lower case keys in the other??
Is there any rational behind this?