nielsvaes / dcs_code_injector

Application to interact with Digital Combat Simulator while a mission is running
http://www.coconutcockpit.com
GNU General Public License v3.0
19 stars 4 forks source link

string.match doesn't work with patterns #5

Closed DarkXilef closed 1 year ago

DarkXilef commented 1 year ago

In the DCS Code Injector the line trigger.action.outText(tostring(string.match("zone1", '%d+')),10) returns nil. The line directly in DCS over triggers returns 1. If I remove the pattern e.g. trigger.action.outText(tostring(string.match("zone1", '1')),10) it returns 1.

nielsvaes commented 1 year ago

Sorry missed this report. You are absolutely right, looking into why that's happening

nielsvaes commented 1 year ago

It was due to how I was constructing the final string that gets executed in the game. This will be fixed in v1.0.5

------------------- CODE BLOCK -------------------
01          numbers = string.match("zone121", "%d+")
02          print(numbers)
03          
04          

------------------ /CODE BLOCK -------------------
2023-08-28 02:54:22.624 INFO    SCRIPTING (Main):   3521(     2)/I:         BASE00000.print(121)