Page 1 of 2

Command lua documents

Posted: Tue Mar 08, 2022 11:38 am
by michaelm75au
I am working on updating the page. Basically one function/wrapper/method at a time. :)

If there are any actual errors that you have noticed, please add them here.

Re: Command lua documents

Posted: Tue Mar 08, 2022 12:36 pm
by KnightHawk75
I've noticed the updates over the last week or so. :) My 2 cents is it's harder to read now (more scrolling involved, harder on the eyeballs to quickly scan something) but maybe I just have to get used to it, but opinions I'm sure vary. I haven't noticed any new errors, but will post if I do over time.

Re: Command lua documents

Posted: Tue Mar 08, 2022 11:43 pm
by michaelm75au
Yes, there is a lot of information on that one page.
I use the side navigation to get to the section I want (eg wrappers).
And then click on the wrapper in question which should jump me to the wrapper details.
Even then some entries can have a items under it (eg unit wrapper).

Re: Command lua documents

Posted: Wed Mar 09, 2022 8:51 pm
by michaelm75au
I'm looking at splitting the one 'index' page into other 'pages' so it is not all one page to see if that helps. So clicking on say Functions, will bring up just the functions on the screen.

Re: Command lua documents

Posted: Sat Mar 12, 2022 6:30 pm
by nukkxx5058
Hi, I think this is not correct. Are these subtypes or categories ? Where are the subtypes (both parts say "category codes"). Are "mobile vehicles" fixed facilities ? Can't find any 2000 category. Pretty much unclear imo ...
FACILITY.jpg
FACILITY.jpg (37.93 KiB) Viewed 10082 times

Re: Command lua documents

Posted: Tue Mar 15, 2022 2:15 am
by michaelm75au
That is correct, but the 'Mobile' relates to a new type of unit 'Ground' which is not in the Public builds.
I'll update the page to indicate it is 'Pro Only' at the moment.

Re: Command lua documents

Posted: Tue Mar 15, 2022 7:18 am
by nukkxx5058
Ah Ok ! I see.
But otherwise it says category and subtypes. but I see just one list of codes. Are these subtypes or categories ?
And what does "description = code" means ? Shouldn't it be code = description to keep the same order ?
Generally speaking, a short explanation would be very welcomed ... as well as examples - they are often missing in the Lua doc.
I find it all rather confusing and quite hard to use the Lua documentation. Probably because I'm not a seasoned programmer.

Re: Command lua documents

Posted: Tue Mar 15, 2022 9:00 am
by KnightHawk75
michaelm75au wrote: Tue Mar 15, 2022 2:15 am That is correct, but the 'Mobile' relates to a new type of unit 'Ground' which is not in the Public builds.
I'll update the page to indicate it is 'Pro Only' at the moment.
This not entirely so Michael, it relates to the category code for the mobile type facility. Ie those of type facility, category 500x. The category in non-pro is picked up based on textual parsing of the unit name for those of category 5001. ie "SAM Bn ...xyz" is type: facility, sub-type 5001, category 6, something with " Mech Inf ...." will be category 11. Place a s400 and do a print(unit.category) you'll get 6 back. It's also used in filters for unitsBy(type,[category][subtype]).

Yes if you just add 000 to each it's identical to GroudUnitType so I understand why it's confusing.
What we're talking about is defined in enum MobileUnitCategory in the Facility class.
The documentation line item should remain unchanged but the data for that entry should read:

Code: Select all

    0 = None
    1 = Infantry
    2 = Armor
    3 = Artillery Gun
    4 = Artillery SSM
    5 = AAA
    6 = SAM
    7 = Engineer
    8 = Supply
    9 = Surveillance
    10 = Recon
    11 = MechInfantry
By all means though additionally add Group Unit Category and perhaps Ground Unit Codes too, those both flagged as pro-only though. :( I don't think we can stop confusion caused by the 5001 special cases vs normal cases when it comes to 'categories'.

Ground Unit Category (pro only)

Code: Select all

0	None
1000	Infantry
2000	Armor
3000	Artillery Gun
4000	Artillery SSM
5000	AAA
6000	SAM
7000	Engineer
8000	Supply
9000	Surveillance
10000	Recon
11000	MechInfantry
Ground Unit Codes (pro only)

Code: Select all

1001	Troop Carrying
1002	Open Topped
2001	Amphibious
2002	Combat Swimmer
3001	Reactive Armor
3002	Mesh Skirting
3003	Depleted Uranium Armor (1st Gen)
3004	Depleted Uranium Armor (2nd Gen)
3005	Depleted Uranium Armor (3rd Gen)
4001	Wheeled Vehicle
4002	Half-Track Vehicle
4003	Tracked Vehicle

Re: Command lua documents

Posted: Thu Mar 31, 2022 7:16 am
by michaelm75au
As I am going thru every line of the documents at the moment, I will be checking and correcting the page or code that may be incorrect.
One thing I am doing is expanding the function details; they will be more consistent in what they show.
Also I am putting in the actual parameters that are valid for the function rather than relying on the 'selector'. I have found that the 'Selector' is often too broad and doesn't indicated additional (or not valid) items.
This also helps in that you don't need to jump back and forth between the command and the selector pages.
lua doc image1.jpg
lua doc image1.jpg (548.63 KiB) Viewed 9996 times
Example below

Re: Command lua documents

Posted: Fri Apr 01, 2022 8:49 am
by KnightHawk75
michaelm75au wrote: Thu Mar 31, 2022 7:16 am As I am going thru every line of the documents at the moment, I will be checking and correcting the page or code that may be incorrect.
One thing I am doing is expanding the function details; they will be more consistent in what they show.
Also I am putting in the actual parameters that are valid for the function rather than relying on the 'selector'. I have found that the 'Selector' is often too broad and doesn't indicated additional (or not valid) items.
This also helps in that you don't need to jump back and forth between the command and the selector pages.lua doc
Example below
ThumbsUpSmall2.gif
ThumbsUpSmall2.gif (4.85 KiB) Viewed 9980 times
I think that will be very helpful and welcomed by most.

Re: Command lua documents

Posted: Wed Apr 06, 2022 2:42 am
by wirthlin
Here's one I ran into just tonight:

World_GetCircleFromPoint (table) -

Parameters:
latitude
longitude
numpoints

Need to add "radius" (expressed in nautical miles) to the list of parameters

local t = World_GetCircleFromPoint({latitude=45, longitude=45, numpoints=16, radius=10})

Re: Command lua documents

Posted: Sat Apr 09, 2022 8:17 pm
by KnightHawk75
current:
ReferencePointSelector
Reference point selector.

To select reference point(s), specify either

name and side, to select a reference pointname belonging toside [name AND side if possible] or
guid, if the unique ID of the reference point is known [preferred] or
area, table of reference points (name or guid)

GUID method takes precedence over name/side if both present.
...
Proposed:
ReferencePointSelector
Reference point selector.

To select reference point(s), specify either
name and side, to select a reference point name belonging to side or
guid, if the unique ID of the reference point is known [preferred] or
area, table of reference points (name or guid) - valid for certain functions, such as GetReferencePoints().

GUID method takes precedence over name/side if both present.
In cases where side is not know by context, then both guid and side may be required, such as DeleteReferencePoint().
...
For instance you can't use DeleteReferencePoint({guid=validguidhere}) at present in 1147.44 or prior, you need to provide the side as well.

Re: Command lua documents

Posted: Sun May 08, 2022 10:00 am
by KnightHawk75
ScenEdit_SetMission | AAR table.

The documentation leads one to believe TankerMissionList accepts names or guids, such as
TankerMissionList= {'support mission1','support mission2'}; is valid when it is not. At present it must be the mission guid.
ie
TankerMissionList= {'ABCDEF-0000000000123','ABCDEF-0000000000124'};

The code that looks up and the array entry text is fine (it checks both name or guid successfully) and returns the mission, however the outer call also does a check upon return and it only validates/compares checks on the guid property vs the entry text. The later seems to not know the former already did the validation for it, so other then the null check the rest of the extra checks causes the issue (and probably no longer needs to be there).

So either the docs need clarity, or the code eyeballed and tweaked to work as expected and believe already desired.

Re: Command lua documents

Posted: Sat May 28, 2022 6:18 am
by michaelm75au
I have done my first pass thru the Lua Command Doc, and corrected/expanded several items.

One big change is that the functions will bring up their own page. This will allow the functional details and examples to be expanded on for each function without impacting the overall page view like it is currently with just the one page.

http://commandlua.github.io/index2.html

I still need to review these functions as of new big 'beta' build (1243??) as there has been some changes.

So this is still a work in progress at the moment, but you can still use the new link above if you wish.

Re: Command lua documents

Posted: Sat May 28, 2022 6:38 am
by michaelm75au
KnightHawk75 wrote: Sun May 08, 2022 10:00 am ScenEdit_SetMission | AAR table.

The documentation leads one to believe TankerMissionList accepts names or guids, such as
TankerMissionList= {'support mission1','support mission2'}; is valid when it is not. At present it must be the mission guid.
ie
TankerMissionList= {'ABCDEF-0000000000123','ABCDEF-0000000000124'};

The code that looks up and the array entry text is fine (it checks both name or guid successfully) and returns the mission, however the outer call also does a check upon return and it only validates/compares checks on the guid property vs the entry text. The later seems to not know the former already did the validation for it, so other then the null check the rest of the extra checks causes the issue (and probably no longer needs to be there).

So either the docs need clarity, or the code eyeballed and tweaked to work as expected and believe already desired.
I have picked this up in the last round of checks.
Thanks :)

Re: Command lua documents

Posted: Sat Jan 14, 2023 7:46 pm
by Parel803
Good evening,

Got on this page: https://commandlua.github.io/assets/Fun ... sions.html
an error 404, file not found
Can be on my side but just to let you know.

best regards GJ

Re: Command lua documents

Posted: Sun Jan 15, 2023 11:58 am
by michaelm75au
Yea, it is missing from the upload. I will find and repost to docs.

Re: Command lua documents

Posted: Sun Jan 29, 2023 5:21 am
by KnightHawk75
michaelm75au wrote: Sun Jan 15, 2023 11:58 am Yea, it is missing from the upload. I will find and repost to docs.
Found another one generating 404 for Tool_LOS_Points.
http://commandlua.github.io/assets/Func ... oints.html

Re: Command lua documents

Posted: Sun Jan 29, 2023 11:36 am
by michaelm75au
Should be fixed. The case of the file name was different to that uploaded to github.

Re: Command lua documents

Posted: Tue Feb 14, 2023 9:25 pm
by KnightHawk75
Any chance we could get UI_SelectUnitPrompt_FromSides() and _OwnSide, and Tool_UIwindow docs?

Also fyi under Wrappers, Zones, the zonemarker link goes to 404 link.