Add/Removing Data/Comm Links through LUA?
Posted: Mon Apr 02, 2018 9:14 am
This is this possible?
What's your Strategy?
https://forums.matrixgames.com:443/
Code: Select all
local unit = ScenEdit_GetUnit({side="BLUFOR", unitname="MIG-21"})
print(unit)
print(unit.components)
print(unit:filterOnComponent("Sensor"))unit {
type = 'Aircraft',
subtype = '2001',
name = 'MIG-21',
side = 'BLUFOR',
guid = '6d088198-4a5b-44a5-b87f-75da50f8cf8c',
proficiency = 'Regular',
latitude = '0.706202368990351',
longitude = '-2.44914023444803',
altitude = '10972.8',
heading = '0',
speed = '350',
throttle = 'Loiter',
autodetectable = 'False',
mounts = '1',
magazines = '1',
unitstate = 'Unassigned',
fuelstate = 'None',
weaponstate = 'None',
}
{ [1] = { comp_guid = '33dec6b3-3bef-4858-8c92-4aaf4b8cc31a', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 887, comp_name = 'Jay Bird [RP-22M Sapfir-22]' }, [2] = { comp_guid = '6771ae2d-0e11-413a-9321-b1bf0cd7483d', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 2750, comp_name = 'SPO-10 Sirena-3M' }, [3] = { comp_guid = 'fe11edda-9b00-4175-a83e-369157d354af', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 0, comp_name = 'Mk1 Eyeball' }, [4] = { comp_guid = '721ecc1f-ca3d-42a7-b460-ef43829868c7', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 274, comp_name = '23mm Gsh-23L [200 rnds]' }, [5] = { comp_guid = '0231e457-4203-4dfc-81ce-5ff0068b6c58', comp_type = 'CommDevice', comp_status = 'Operational', comp_dbid = 20, comp_name = 'UHF/VHF Radio [Unsecure]' }, [6] = { comp_guid = 'f6058dbb-6ce0-4bb0-816b-04437e4a3e75', comp_type = 'Engine', comp_status = 'Operational', comp_dbid = 393, comp_name = 'R-25-300 #1' } }
{ [1] = { comp_guid = '33dec6b3-3bef-4858-8c92-4aaf4b8cc31a', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 887, comp_name = 'Jay Bird [RP-22M Sapfir-22]' }, [2] = { comp_guid = '6771ae2d-0e11-413a-9321-b1bf0cd7483d', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 2750, comp_name = 'SPO-10 Sirena-3M' }, [3] = { comp_guid = 'fe11edda-9b00-4175-a83e-369157d354af', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 0, comp_name = 'Mk1 Eyeball' } }
Properties are indicated by ".", and methods/functions are indicated by ":".ORIGINAL: LHOANWG
Ah, it was the ":" that I was not using. Lua syntax calls methods differently apparently. Thanks for the help!