Jump to content

CheckLaserCode

From CMM Wiki
Revision as of 10:12, 11 November 2025 by Ozdeadmeat (talk | contribs) (CheckLaserCode – created via PowerShell script (2025-11-11T21:12:00Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: CheckLaserCode
Function Description: Validates that a supplied laser code is within the official DCS World range (1111–2688) and matches the expected four‑digit pattern. The function converts the number to a string, checks its numeric bounds, then uses a regular expression to confirm it follows the [1-2][1-8][1-8][1-8] format. If CMM.DEBUG is true, diagnostic messages are logged.
File Location: cmm.DCSFunctions.lua
Syntax: CMM.CheckLaserCode( number LaserCode )
Return Value: boolean
Parameters: Name Description
LaserCodeThe laser code value to validate (e.g., 1788).
Example: env.info("Is LaserCode valid? "..tostring(CMM.CheckLaserCode(1788)))
Example Description: Demonstrates checking whether the laser code "1788" is valid and logging the result.
Related Functions:
Notes: