Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Dump the properties of Lua wrapper

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Dump the properties of Lua wrapper Page: [1]
Login
Message << Older Topic   Newer Topic >>
Dump the properties of Lua wrapper - 7/19/2018 10:27:49 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I may have mentioned this in passing before, but I thought I would update it.
You can get a list of the property names of a Lua wrapper by a query on the wrapper.fields. This is handy sometimes to see what is available in case the WIKI is not up to date.

Example.
local a = ScenEdit_GetUnit({name='LST 4001 Osumi', guid='8269b881-20ce-4f2e-baa0-6823e46d55a4'})

print(a.fields) -- shows you a list of all the property and method names associated with the wrapper (in this case the unit one)

You can use this to show a list all the properties and their current values.

for k,v in pairs(a.fields) do
if string.find(k,'property_') ~= nil then
local t = string.find(v," , ") -- location of first ,
print("\r\n[object] = " .. string.sub(v,2,t-1) ) -- property name
print( a[string.sub(v,2,t-1)] ) -- value of property
end
end



< Message edited by michaelm75au -- 7/19/2018 10:53:35 AM >


_____________________________

Michael
Post #: 1
RE: Dump the properties of Lua wrapper - 7/19/2018 10:31:02 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Example of output:

{ property_38 = '.condition , String , False', property_16 = '.sprintDrift , Boolean , True', property_22 = '.side , String , False', property_26 = '.airbornetime , Object , False', property_29 = '.damage , LuaTable , False', property_47 = '.targetedBy , Object , False', property_8 = '.throttle , Object , True', property_5 = '.speed , Object , True', property_15 = '.base , LuaWrapper_ActiveUnit , True', property_3 = '.autodetectable , Boolean , True', property_20 = '.name , String , True', property_4 = '.altitude , Object , True', property_14 = '.OODA , LuaTable , True', method_4 = ':inArea , System.Boolean', property_32 = '.weather , LuaTable , False', property_27 = '.readytime , Object , False', property_6 = '.manualAltitude , Object , True', property_48 = '.firingAt , Object , False', property_25 = '.holdfire , Object , True', method_3 = ':rangetotarget , System.Single', property_13 = '.heading , Object , True', property_37 = '.components , LuaTable , True', property_34 = '.magazines , LuaTable , True', property_45 = '.areaTriggersFired , LuaTable , False', method_1 = ':delete , System.Void', property_50 = '.isOperating , Boolean , False', property_49 = '.firedOn , Object , False', property_46 = '.hostedUnits , LuaTable , False', property_28 = '.loadoutdbid , Object , False', property_18 = '.type , String , False', property_2 = '.longitude , Double , True', property_44 = '.hostFacility , LuaWrapper_Facility , False', property_12 = '.formation , LuaTable , True', property_43 = '.weapon , Object , False', property_42 = '.weaponstate , String , False', property_41 = '.fuelstate , String , False', property_24 = '.holdposition , Boolean , True', property_39 = '.condition_v , String , False', property_36 = '.sensors , LuaTable , True', property_35 = '.mounts , LuaTable , True', property_33 = '.proficiency , String , True', method_2 = ':filterOnComponent , NLua.LuaTable', property_10 = '.fuel , LuaTable , True', property_23 = '.mission , Object , True', property_31 = '.desiredheading , Object , True', property_9 = '.course , LuaTable , True', property_30 = '.ascontact , LuaTable , False', property_21 = '.guid , String , False', property_40 = '.unitstate , String , False', property_1 = '.latitude , Double , True', property_7 = '.manualSpeed , Object , True', property_19 = '.dbid , Int32 , False', property_17 = '.subtype , String , False', property_11 = '.group , Object , True' }

[object] = condition
Underway
[object] = sprintDrift
'No'
[object] = side
SideA
[object] = airbornetime
nil
[object] = damage
{ dp = 1490, fires = 'NoFire', startdp = '1490', flood = 'NoFlooding' }
[object] = targetedBy
nil
[object] = throttle
FullStop
[object] = speed
0
[object] = base
nil
[object] = autodetectable
'No'
[object] = name
LST 4001 Osumi
[object] = altitude
0
[object] = OODA
{ detection = 15, evasion = 2, targeting = 15 }
[object] = weather
{ rainfall = 0, undercloud = 0, seastate = 0, temp = 25 }
[object] = readytime
0
[object] = manualAltitude
'No'
[object] = firingAt
nil
[object] = holdfire
{ Land = 'Inherit', SubSurface = 'Inherit', Air = 'Inherit', Surface = 'Inherit' }
[object] = heading
0
[object] = components
{ [1] = { comp_guid = 'e9de3642-205a-44b1-a619-4bad9877e92d', comp_name = 'J/OPS-14C', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 2994 }, [2] = { comp_guid = '33496d54-eb05-40ba-9b12-e6463246d186', comp_name = 'J/OPS-18A', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 1177 }, [3] = { comp_guid = '33e91ecc-198f-4f2f-8358-0739344fb69e', comp_name = 'J/OPS-20', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 1036 }, [4] = { comp_guid = 'd6f22747-5ad1-4ba3-b3ae-bfe9cf667c0e', comp_name = 'J/OPS-28C', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 1180 }, [5] = { comp_guid = '6ac912bc-dbf5-41ce-99dd-8037ac8ed835', comp_name = 'Mk1 Eyeball', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 0 }, [6] = { comp_guid = '1a6583ae-e225-4635-a889-dc5521516d9b', comp_name = 'AN/VPS-2 Search/Track [Mk16 CWIS]', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 1650 }, [7] = { comp_guid = 'f5008eca-ae1f-4f53-85e3-48523cd0a634', comp_name = 'AN/VPS-2 Search/Track [Mk16 CWIS]', comp_type = 'Sensor', comp_status = 'Operational', comp_dbid = 1650 }, [8] = { comp_guid = 'fa6f6e50-af94-4fc2-aefd-44c3909c8194', comp_name = '12.7mm/50 MG', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 561 }, [9] = { comp_guid = 'e791d810-b777-4050-bca1-4e9bce55c424', comp_name = '12.7mm/50 MG', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 561 }, [10] = { comp_guid = '2c0ce75a-b307-4e80-b390-ec4d26f9c654', comp_name = '20mm/85 Mk15 Phalanx Blk 1 CIWS', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 542 }, [11] = { comp_guid = '96da87de-5476-4ca5-bd4b-ea77209b80e4', comp_name = '20mm/85 Mk15 Phalanx Blk 1 CIWS', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 542 }, [12] = { comp_guid = '7b2a8bf1-b7fb-43cc-af64-97603a278621', comp_name = 'Mk36 SRBOC', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 565 }, [13] = { comp_guid = 'fbd82461-4dd8-4106-a7a8-0cc973f690a5', comp_name = 'Mk36 SRBOC', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 565 }, [14] = { comp_guid = '6abdae96-0168-49cc-b553-d0a02f413e70', comp_name = 'Mk36 SRBOC', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 565 }, [15] = { comp_guid = '6a97dfbb-ff0c-4db9-8825-7d6ccf007b7a', comp_name = 'Mk36 SRBOC', comp_type = 'Mount', comp_status = 'Operational', comp_dbid = 565 }, [16] = { comp_guid = 'dfa22829-693a-4239-bb97-c91f90d263d4', comp_name = 'VHF Radio [Secure]', comp_type = 'CommDevice', comp_status = 'Operational', comp_dbid = 209 }, [17] = { comp_guid = '0faf4083-b3ef-4b0d-9887-9d1eabeb61f2', comp_name = 'AN/WSC-3 FLTSATCOM SHF Shipboard Transceiver', comp_type = 'CommDevice', comp_status = 'Operational', comp_dbid = 218 }, [18] = { comp_guid = 'a227de13-de1b-4bb3-baa3-af1164d9961e', comp_name = 'Link 14', comp_type = 'CommDevice', comp_status = 'Operational', comp_dbid = 219 }, [19] = { comp_guid = '09f88b30-e00f-4745-9c09-fe65bcfdfbb4', comp_name = 'MILSTAR SATCOM UHF', comp_type = 'CommDevice', comp_status = 'Operational', comp_dbid = 222 }, [20] = { comp_guid = 'b7c2067f-0c0a-478d-ac73-d20e550434c1', comp_name = 'UHF Radio [Secure]', comp_type = 'CommDevice', comp_status = 'Operational', comp_dbid = 264 }, [21] = { comp_guid = '2babbe24-0ebb-4413-ba54-4245a8ba9f6a', comp_name = 'Dock Well (2x Large Dock (LCU/LCAC, 25.1-45m Long))', comp_type = 'DockFacility', comp_status = 'Operational', comp_dbid = 7 }, [22] = { comp_guid = '317d2e0b-0fa2-4e62-bf82-d4195b71c7c6', comp_name = 'Pad (1x Medium Aircraft (12.1-18m Long))', comp_type = 'AirFacility', comp_status = 'Operational', comp_dbid = 57 }, [23] = { comp_guid = '4debec89-b073-4895-b990-03b15d247c98', comp_name = 'Pad (1x Medium Aircraft (12.1-18m Long))', comp_type = 'AirFacility', comp_status = 'Operational', comp_dbid = 57 }, [24] = { comp_guid = '74147cfb-df6b-4053-b275-9486962e8b12', comp_name = 'Open Parking (2x Medium Aircraft (12.1-18m Long))', comp_type = 'AirFacility', comp_status = 'Operational', comp_dbid = 21 }, [25] = { comp_guid = '8b7d836e-9944-4e0f-bfb1-b17c4f1a5b1f', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [26] = { comp_guid = '306a04a2-4145-46c0-b4a6-3af2815b8644', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [27] = { comp_guid = '449d3053-4c3c-4bfd-8fd2-eb65384a5beb', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [28] = { comp_guid = '2604a87d-f855-4ad4-a5f6-a724f301d4e1', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [29] = { comp_guid = '12459b2c-ebaf-4229-91fa-c9c1f80109e6', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [30] = { comp_guid = 'd929ad86-ffa8-4a62-ace3-f0f3c5d93542', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [31] = { comp_guid = 'd640be95-95e6-4ead-aa42-cc5d52ecc1c9', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [32] = { comp_guid = '5888bf98-876d-418d-ad24-1ae8a78d5e59', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [33] = { comp_guid = '2b46cb02-5a86-4171-bc0b-e34cfbab295d', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [34] = { comp_guid = '53e86349-967c-479f-920a-2f6bb5a0f33d', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [35] = { comp_guid = 'a8f565d1-79d5-46f8-8da4-6eccdf4d3597', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [36] = { comp_guid = 'e876e161-d77c-4648-8f6f-05a08e01967b', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [37] = { comp_guid = '671a9039-707f-4052-9069-544637b5e467', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [38] = { comp_guid = 'f782e200-4b13-4952-81a5-97901c97aff0', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [39] = { comp_guid = '0bfbc39b-7a74-4057-acae-4261fc37c6b4', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [40] = { comp_guid = '2bc6f08c-e732-49e6-a8de-dc57f0632942', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [41] = { comp_guid = 'a04daaf5-e001-4686-a403-b35ff6c4f23c', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [42] = { comp_guid = 'eb8636fa-315e-44cb-bf61-fdcbdfffab5d', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [43] = { comp_guid = '6a2b25a4-93e3-4462-9fc2-9ba9d2423210', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [44] = { comp_guid = 'b518d1f7-b54f-47bc-ad50-500f096cf253', comp_name = 'Infantry Section [7.62mm MG/Unguided Infantry Anti Tank Weapon]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2884 }, [45] = { comp_guid = 'e68dfee9-c7eb-42e7-a64a-fcc04f9a9691', comp_name = '81mm Mortar', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 132 }, [46] = { comp_guid = 'b3936b09-77a5-47c0-8072-d603fa0f3960', comp_name = '81mm Mortar', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 132 }, [47] = { comp_guid = '547d146a-b5d3-4b33-894d-5fdd21fcf49b', comp_name = '81mm Mortar', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 132 }, [48] = { comp_guid = '89277140-b477-4efa-9d92-f97f0d3cc457', comp_name = '81mm Mortar', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 132 }, [49] = { comp_guid = '609b792b-8562-445d-9fa3-518b8bd95a7e', comp_name = '81mm Mortar', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 132 }, [50] = { comp_guid = 'd01ad060-0ac8-4c2a-a34b-0ab17f9097f7', comp_name = '81mm Mortar', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 132 }, [51] = { comp_guid = '4581abea-35d3-439a-80a8-2ec7d05a2dc5', comp_name = 'LAV-25 [25mm/75 M242 Bushmaster]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2234 }, [52] = { comp_guid = '82180f9d-d19d-4718-a482-ca4a56878b9e', comp_name = 'LAV-25 [25mm/75 M242 Bushmaster]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2234 }, [53] = { comp_guid = '0da09656-7b52-41eb-8f7e-e5cea70e040e', comp_name = 'LAV-25 [25mm/75 M242 Bushmaster]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2234 }, [54] = { comp_guid = 'c972511d-7659-4882-8b8a-d777b4cb30ea', comp_name = 'LAV-25 [25mm/75 M242 Bushmaster]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2234 }, [55] = { comp_guid = 'ddfef949-26fc-4f81-bb9f-ebb22fe456b5', comp_name = 'LAV-25 [25mm/75 M242 Bushmaster]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2234 }, [56] = { comp_guid = '9962a277-4f6c-4666-8f54-fb3ec534b03a', comp_name = 'LAV-25 [25mm/75 M242 Bushmaster]', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 2234 }, [57] = { comp_guid = '8f17fbae-2fb5-4b7f-a57a-12af0d2a9aa7', comp_name = 'M1A2 Abrams Main Battle Tank', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 754 }, [58] = { comp_guid = '47fdfb43-7eaf-46be-bc3d-4e5b49574482', comp_name = 'M1A2 Abrams Main Battle Tank', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 754 }, [59] = { comp_guid = 'f8a74463-8833-4514-8c00-73a42c7210c8', comp_name = 'M1A2 Abrams Main Battle Tank', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 754 }, [60] = { comp_guid = '99227e14-e3b1-4c54-afb9-fdb26eafe408', comp_name = 'M1A2 Abrams Main Battle Tank', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 754 }, [61] = { comp_guid = 'b2073e15-77e3-4335-88b6-152a46095fc7', comp_name = 'M1A2 Abrams Main Battle Tank', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 754 }, [62] = { comp_guid = 'd9b062be-a7f3-4c22-b346-aa49c8a8cdf0', comp_name = 'M1A2 Abrams Main Battle Tank', comp_type = 'Cargo', comp_status = 'Operational', comp_dbid = 754 }, [63] = { comp_guid = 'b584aba1-2ebc-43b1-84cf-a9abc3c96b8c', comp_name = '2x Mitsui-SEMT-Pielstick 16V42M-A Diesels', comp_type = 'Engine', comp_status = 'Operational', comp_dbid = 1026 }, [64] = { comp_guid = '59d07524-47be-4663-b5ae-b34911b42238', comp_name = '12.7mm/50 MG', comp_type = 'Magazine', comp_status = 'Operational', comp_dbid = 761 }, [65] = { comp_guid = '194ad06a-6a60-41a1-95e0-b93140a0ab55', comp_name = '20mm/85 Mk15 Phalanx Blk 1', comp_type = 'Magazine', comp_status = 'Operational', comp_dbid = 545 }, [66] = { comp_guid = '90bdecb4-b294-47a2-8141-79395965b53c', comp_name = 'Helicopter Magazine', comp_type = 'Magazine', comp_status = 'Operational', comp_dbid = 1302 }, [67] = { comp_guid = 'd97c16d2-b895-4a61-b7b7-0588c854b5fb', comp_name = 'Mk36 SRBOC', comp_type = 'Magazine', comp_status = 'Operational', comp_dbid = 597 } }
[object] = magazines
{ [1] = { mag_weapons = { [1] = { wpn_guid = '8c12a4a9-731d-4cf3-9b84-5f0b896cfd1d', wpn_maxcap = 200, wpn_default = 200, wpn_dbid = 1695, wpn_name = '12.7mm/50 MG Burst [10 rnds]', wpn_current = 200 } }, mag_name = '12.7mm/50 MG', mag_dbid = 761, mag_guid = '59d07524-47be-4663-b5ae-b34911b42238', mag_capacity = 200 }, [2] = { mag_weapons = { [1] = { wpn_guid = 'e9f3a062-b893-4d3b-98ac-db64c568f68e', wpn_maxcap = 20, wpn_default = 20, wpn_dbid = 1630, wpn_name = '20mm/85 Mk15 Phalanx Blk 1 Burst [300 rnds]', wpn_current = 20 } }, mag_name = '20mm/85 Mk15 Phalanx Blk 1', mag_dbid = 545, mag_guid = '194ad06a-6a60-41a1-95e0-b93140a0ab55', mag_capacity = 20 }, [3] = { mag_weapons = { [1] = { wpn_guid = '8674170e-fe67-4c6f-913d-8ce28d614d61', wpn_maxcap = 24, wpn_default = 24, wpn_dbid = 617, wpn_name = 'AGM-114M Hellfire II', wpn_current = 24 }, [2] = { wpn_guid = '3477a79c-0240-4165-998f-bcfd2bef992d', wpn_maxcap = 40, wpn_default = 40, wpn_dbid = 1647, wpn_name = 'Mk46 NEARTIP Mod 5', wpn_current = 40 } }, mag_name = 'Helicopter Magazine', mag_dbid = 1302, mag_guid = '90bdecb4-b294-47a2-8141-79395965b53c', mag_capacity = 10000 }, [4] = { mag_weapons = { [1] = { wpn_guid = '2a99c0b4-724b-46bb-8a2e-3e5d70c785e7', wpn_maxcap = 80, wpn_default = 64, wpn_dbid = 232, wpn_name = 'Mk182 SRBOC Chaff [Seduction]', wpn_current = 64 }, [2] = { wpn_guid = '5e5af0e1-3cf6-4d09-a228-7c688af61605', wpn_maxcap = 80, wpn_default = 16, wpn_dbid = 233, wpn_name = 'Mk186 TORCH Flare [Seduction]', wpn_current = 16 } }, mag_name = 'Mk36 SRBOC', mag_dbid = 597, mag_guid = 'd97c16d2-b895-4a61-b7b7-0588c854b5fb', mag_capacity = 80 } }
[object] = areaTriggersFired
{ }
[object] = isOperating
'Yes'
[object] = firedOn
nil
[object] = hostedUnits
{ Boats = { [1] = '2e324031-e62c-4bb7-8351-cba87d1d867e', [2] = '0bbdc89f-3312-418e-b130-d835a9a8fbec', [3] = '3544790b-19ef-464e-9a77-a2d48f851495', [4] = '7bd658f0-83b5-4e85-8431-a4b6101a1802', 4 = '7bd658f0-83b5-4e85-8431-a4b6101a1802', 1 = '2e324031-e62c-4bb7-8351-cba87d1d867e', 2 = '0bbdc89f-3312-418e-b130-d835a9a8fbec', 3 = '3544790b-19ef-464e-9a77-a2d48f851495' }, Aircraft = { [1] = '7a3b7dce-abe1-4b60-b0d5-b0f27510d4de', [2] = 'e7bb5afe-033d-4f9f-a248-067484d6168c', 2 = 'e7bb5afe-033d-4f9f-a248-067484d6168c', 1 = '7a3b7dce-abe1-4b60-b0d5-b0f27510d4de' } }
[object] = loadoutdbid
nil
[object] = type
Ship
[object] = longitude
137.655665231357
[object] = hostFacility
nil
[object] = formation
nil
[object] = weapon
nil
[object] = weaponstate
None
[object] = fuelstate
None
[object] = holdposition
'No'
[object] = condition_v
Underway
[object] = sensors
{ [1] = { sensor_isactive = 'No', sensor_type = 2001, sensor_guid = 'e9de3642-205a-44b1-a619-4bad9877e92d', sensor_maxrange = 120, sensor_dbid = 2994, sensor_status = 'Operational', sensor_name = 'J/OPS-14C', sensor_role = 2003 }, [2] = { sensor_isactive = 'No', sensor_type = 2001, sensor_guid = '33496d54-eb05-40ba-9b12-e6463246d186', sensor_maxrange = 40, sensor_dbid = 1177, sensor_status = 'Operational', sensor_name = 'J/OPS-18A', sensor_role = 2023 }, [3] = { sensor_isactive = 'No', sensor_type = 2001, sensor_guid = '33e91ecc-198f-4f2f-8358-0739344fb69e', sensor_maxrange = 25, sensor_dbid = 1036, sensor_status = 'Operational', sensor_name = 'J/OPS-20', sensor_role = 2028 }, [4] = { sensor_isactive = 'No', sensor_type = 2001, sensor_guid = 'd6f22747-5ad1-4ba3-b3ae-bfe9cf667c0e', sensor_maxrange = 110, sensor_dbid = 1180, sensor_status = 'Operational', sensor_name = 'J/OPS-28C', sensor_role = 2103 }, [5] = { sensor_isactive = 'No', sensor_type = 2003, sensor_guid = '6ac912bc-dbf5-41ce-99dd-8037ac8ed835', sensor_maxrange = 50, sensor_dbid = 0, sensor_status = 'Operational', sensor_name = 'Mk1 Eyeball', sensor_role = 2016 }, [6] = { sensor_isactive = 'No', sensor_type = 2001, sensor_guid = '1a6583ae-e225-4635-a889-dc5521516d9b', sensor_maxrange = 2.70000004768372, sensor_dbid = 1650, sensor_status = 'Operational', sensor_name = 'AN/VPS-2 Search/Track [Mk16 CWIS]', sensor_role = 2133 }, [7] = { sensor_isactive = 'No', sensor_type = 2001, sensor_guid = 'f5008eca-ae1f-4f53-85e3-48523cd0a634', sensor_maxrange = 2.70000004768372, sensor_dbid = 1650, sensor_status = 'Operational', sensor_name = 'AN/VPS-2 Search/Track [Mk16 CWIS]', sensor_role = 2133 } }
[object] = mounts
{ [1] = { mount_guid = 'fa6f6e50-af94-4fc2-aefd-44c3909c8194', mount_name = '12.7mm/50 MG', mount_status = 'Operational', mount_dbid = 561, mount_weapons = { [1] = { wpn_guid = 'fcdfe056-8502-46bf-aac5-c4a854605aa7', wpn_maxcap = 10, wpn_default = 10, wpn_dbid = 1695, wpn_current = 10, wpn_name = '12.7mm/50 MG Burst [10 rnds]', wpn_type = 2004 } } }, [2] = { mount_guid = 'e791d810-b777-4050-bca1-4e9bce55c424', mount_name = '12.7mm/50 MG', mount_status = 'Operational', mount_dbid = 561, mount_weapons = { [1] = { wpn_guid = 'c421783c-3d75-423b-a1f9-4c49a21fbae7', wpn_maxcap = 10, wpn_default = 10, wpn_dbid = 1695, wpn_current = 10, wpn_name = '12.7mm/50 MG Burst [10 rnds]', wpn_type = 2004 } } }, [3] = { mount_guid = '2c0ce75a-b307-4e80-b390-ec4d26f9c654', mount_name = '20mm/85 Mk15 Phalanx Blk 1 CIWS', mount_status = 'Operational', mount_dbid = 542, mount_weapons = { [1] = { wpn_guid = '3cf06dbb-ce3d-4901-b06a-f338a9dd2c38', wpn_maxcap = 5, wpn_default = 5, wpn_dbid = 1630, wpn_current = 5, wpn_name = '20mm/85 Mk15 Phalanx Blk 1 Burst [300 rnds]', wpn_type = 2004 } } }, [4] = { mount_guid = '96da87de-5476-4ca5-bd4b-ea77209b80e4', mount_name = '20mm/85 Mk15 Phalanx Blk 1 CIWS', mount_status = 'Operational', mount_dbid = 542, mount_weapons = { [1] = { wpn_guid = '6f22aa0a-d433-41dd-a622-421022c7d2ba', wpn_maxcap = 5, wpn_default = 5, wpn_dbid = 1630, wpn_current = 5, wpn_name = '20mm/85 Mk15 Phalanx Blk 1 Burst [300 rnds]', wpn_type = 2004 } } }, [5] = { mount_guid = '7b2a8bf1-b7fb-43cc-af64-97603a278621', mount_name = 'Mk36 SRBOC', mount_status = 'Operational', mount_dbid = 565, mount_weapons = { [1] = { wpn_guid = '495854aa-5ecc-4f56-8c77-268a848f63ac', wpn_maxcap = 6, wpn_default = 4, wpn_dbid = 232, wpn_current = 4, wpn_name = 'Mk182 SRBOC Chaff [Seduction]', wpn_type = 2005 }, [2] = { wpn_guid = '0a42d61b-3825-4011-a820-6b1175272457', wpn_maxcap = 6, wpn_default = 2, wpn_dbid = 233, wpn_current = 2, wpn_name = 'Mk186 TORCH Flare [Seduction]', wpn_type = 2005 } } }, [6] = { mount_guid = 'fbd82461-4dd8-4106-a7a8-0cc973f690a5', mount_name = 'Mk36 SRBOC', mount_status = 'Operational', mount_dbid = 565, mount_weapons = { [1] = { wpn_guid = 'ed8bc25a-f872-4dfa-87bc-4ad2517ec04a', wpn_maxcap = 6, wpn_default = 4, wpn_dbid = 232, wpn_current = 4, wpn_name = 'Mk182 SRBOC Chaff [Seduction]', wpn_type = 2005 }, [2] = { wpn_guid = 'a1cd8e44-5141-4b07-b3bd-d3deb5cef874', wpn_maxcap = 6, wpn_default = 2, wpn_dbid = 233, wpn_current = 2, wpn_name = 'Mk186 TORCH Flare [Seduction]', wpn_type = 2005 } } }, [7] = { mount_guid = '6abdae96-0168-49cc-b553-d0a02f413e70', mount_name = 'Mk36 SRBOC', mount_status = 'Operational', mount_dbid = 565, mount_weapons = { [1] = { wpn_guid = '37cec8ce-8e07-4943-899e-c880a8b74962', wpn_maxcap = 6, wpn_default = 4, wpn_dbid = 232, wpn_current = 4, wpn_name = 'Mk182 SRBOC Chaff [Seduction]', wpn_type = 2005 }, [2] = { wpn_guid = '19d319f8-8315-4fb0-a890-1609e79876f1', wpn_maxcap = 6, wpn_default = 2, wpn_dbid = 233, wpn_current = 2, wpn_name = 'Mk186 TORCH Flare [Seduction]', wpn_type = 2005 } } }, [8] = { mount_guid = '6a97dfbb-ff0c-4db9-8825-7d6ccf007b7a', mount_name = 'Mk36 SRBOC', mount_status = 'Operational', mount_dbid = 565, mount_weapons = { [1] = { wpn_guid = '2f54b5da-3cee-42db-a8c8-926a1b8761b5', wpn_maxcap = 6, wpn_default = 4, wpn_dbid = 232, wpn_current = 4, wpn_name = 'Mk182 SRBOC Chaff [Seduction]', wpn_type = 2005 }, [2] = { wpn_guid = '920c0c15-e53b-4126-8567-330cd01834f6', wpn_maxcap = 6, wpn_default = 2, wpn_dbid = 233, wpn_current = 2, wpn_name = 'Mk186 TORCH Flare [Seduction]', wpn_type = 2005 } } } }
[object] = proficiency
Regular
[object] = fuel
{ [3001] = { name = 'DieselFuel', max = 26667, current = 26667 } }
[object] = mission
nil
[object] = desiredheading
0
[object] = course
{ }
[object] = ascontact
{ }
[object] = guid
8269b881-20ce-4f2e-baa0-6823e46d55a4
[object] = unitstate
Unassigned
[object] = latitude
34.0930076804559
[object] = manualSpeed
nil
[object] = dbid
961
[object] = subtype
4013
[object] = group
nil

_____________________________

Michael

(in reply to michaelm75au)
Post #: 2
RE: Dump the properties of Lua wrapper - 7/19/2018 4:52:49 PM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
Thanks - I had seen something about this, maybe on commandlua but I didn't quite understand what it was getting at - this is a clear example and shows exactly what it is.

Also, nice example with an LST loaded with boats and cargo.

(in reply to michaelm75au)
Post #: 3
RE: Dump the properties of Lua wrapper - 7/31/2018 1:35:24 PM   
kevinkins


Posts: 2257
Joined: 3/8/2006
Status: offline
What is meant by a "wrapper" from a programming POV?

Kevin

< Message edited by kevinkin -- 8/2/2018 4:46:45 PM >

(in reply to Whicker)
Post #: 4
RE: Dump the properties of Lua wrapper - 7/31/2018 2:01:29 PM   
tjhkkr


Posts: 2428
Joined: 6/3/2010
Status: offline
michaelm75au:

Is there a way to dump this to a text file?

_____________________________

Remember that the evil which is now in the world will become yet more powerful, and that it is not evil which conquers evil, but only love -- Olga Romanov.

(in reply to kevinkins)
Post #: 5
RE: Dump the properties of Lua wrapper - 8/1/2018 3:30:11 AM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
I'm no Lua expert, but to me the `wrapper` is just the container for something like a unit which has tons of possible attributes/properties. In the game a unit is a living thing that has lots of things pertaining to it - like within that wrapper (for a unit) could be things like damage, which is its own table of items, or cargo, or weapons etc. I kinda think of it as an object, though I think that is technically incorrect and refers to something similar in other languages like JS.

(in reply to tjhkkr)
Post #: 6
RE: Dump the properties of Lua wrapper - 8/1/2018 3:43:02 AM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
as for writing that to a text file, if you run that (or anything) in the lua console it is already in a txt file - the LuaHistory_[date].txt file found in /logs. Should be easy to find it in there and paste it into its own doc. or just copy it from the lua console into its own file.

The lua language supports writing to a file but I tried to do that and it didn't work (no surprise, I don't really know what I am doing). Maybe cmano-lua didn't include the io library.

(in reply to Whicker)
Post #: 7
RE: Dump the properties of Lua wrapper - 8/1/2018 1:56:41 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
Hi all.

Just an FYI FWIF (don't you just love acronyms). I would compare the "wrapper" to a "structure" found in other programming languages such as C/C++.

Specifically, "Structure is a collection of variables of different types under a single name." (https://www.programiz.com/c-programming/c-structures).

Probably more information than most forum members are interested in.

-Wayne Stiles

(in reply to Whicker)
Post #: 8
RE: Dump the properties of Lua wrapper - 8/2/2018 6:24:58 PM   
tjhkkr


Posts: 2428
Joined: 6/3/2010
Status: offline
quote:

ORIGINAL: stilesw
Hi all.
Just an FYI FWIF (don't you just love acronyms).
-Wayne Stiles


I say this in fun:
No, because I do not know what FWIF means!


_____________________________

Remember that the evil which is now in the world will become yet more powerful, and that it is not evil which conquers evil, but only love -- Olga Romanov.

(in reply to stilesw)
Post #: 9
RE: Dump the properties of Lua wrapper - 8/2/2018 6:41:12 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
Once again I prove that I cannot spell - even acronyms. Sigh!

FWIF should be (obviously) FWIW (For What It's Worth).

Thanks for the catch.

-Wayne

(in reply to tjhkkr)
Post #: 10
RE: Dump the properties of Lua wrapper - 2/9/2019 10:59:30 PM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
another version of how to get all of a units properties.
video explanation:
https://www.youtube.com/watch?v=F5eVMhro9kY

-----------------------------------------------------------------------------
local u = ScenEdit_GetUnit({name='LPD 17 San Antonio', guid='63917afb-6cdb-47b5-9f2a-ffd3e9e86224'})
local tables = {}
for k,v in pairs(u.fields) do
local t = string.find(v," , ")
local t2 = (string.sub(v,2,t-1))
if type(u[t2]) ~= 'table' then
print(t2..': '..tostring(u[t2]))
else
table.insert(tables, t2)
end --end check type

end -- end main pairs loop

print'==================== Table Data ======================'
for k,v in pairs(tables) do
print(v..': ')
for k,v in pairs(u[v]) do
print(k)
print(v)
end --inner table

print('---------- End '..v..' table data ------------------')
print('----------------------------------------------------')
end --end tables loop

(in reply to stilesw)
Post #: 11
RE: Dump the properties of Lua wrapper - 8/2/2019 3:37:28 AM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
when you run this now there is an error on a new field called Launch - and if I just do print(u.Launch) I get an error:ERROR: [string "local function index(obj,name)
..."]:7: unknown member name Launch

I get that error on both my script above and the one by Michael at the top.

I'm guessing Launch is the new way to use lua to launch a unit? I noticed this a few weeks ago but didn't pay any attention.

(in reply to Whicker)
Post #: 12
RE: Dump the properties of Lua wrapper - 8/3/2019 2:34:41 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I'll have a look.

_____________________________

Michael

(in reply to Whicker)
Post #: 13
RE: Dump the properties of Lua wrapper - 8/3/2019 3:33:58 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
The properties Launch and RTB don't have values. They are write-only properties that set flags to force launching and RTBing. May need to to ignore these properties when building table property values.
-------------------
Actually better to add as method instead of a property.

< Message edited by michaelm75au -- 8/3/2019 7:10:54 AM >


_____________________________

Michael

(in reply to michaelm75au)
Post #: 14
RE: Dump the properties of Lua wrapper - 4/29/2020 5:40:28 PM   
1nutworld


Posts: 365
Joined: 4/13/2014
Status: offline

quote:

ORIGINAL: stilesw

Once again I prove that I cannot spell - even acronyms. Sigh!

FWIF should be (obviously) FWIW (For What It's Worth).

Thanks for the catch.

-Wayne


For what it's worth, even though the acronym was spelled incorrectly - I didn't notice it, and READ it as

FWIW!

Maybe that helps some??

_____________________________

USS Dwight D. Eisenhower (CVN-69) 1990-1994.

(in reply to stilesw)
Post #: 15
RE: Dump the properties of Lua wrapper - 6/25/2020 7:18:44 PM   
wqc12345


Posts: 250
Joined: 12/7/2015
From: San Francisco, CA
Status: offline
Getting a crash with this on [object] = base
ERROR: Object reference not set to an instance of an object.

This is for a an aircraft dump.

(in reply to michaelm75au)
Post #: 16
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Dump the properties of Lua wrapper Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.969