TEMPEST.114 Posted April 30, 2024 Posted April 30, 2024 As the title says. If I output the value for Unit.getByName(unitName):getID() it is surrounded by quotes and it's type is a string But if I do this: Unit.getGroup(Unit.getByName(unitName)):getID() It's type is number. So to make the first statement work I have to cast the return value 'tonumber'.
TEMPEST.114 Posted May 6, 2024 Author Posted May 6, 2024 @Flappie Hi. Don't know if you missed this, but could you please test your end? I'm definitely getting strings back and not numbers.
Flappie Posted May 6, 2024 Posted May 6, 2024 Hi. I'm no Grimes: my scripting abilities are very limited. Could you please attach a .miz demonstrating the issue? Maybe by adding 1 to the result, so the first expression works OK, and the second one throws a "string is no number" kind of error. ---
TEMPEST.114 Posted May 7, 2024 Author Posted May 7, 2024 Okay, you're going to need to view the DCS.log as it's running to see the output. I'd suggest the free app called 'BARETAIL' or you can just let this mission run for 5 seconds and then open dcs.log in your texteditor of choice. This is the results you get from the two function calls listen in my original post: 2024-05-07 10:26:37.427 INFO SCRIPTING (Main): { [1] = "1", [2] = 1, } Notice that the first result as double quotation marks around it? That denotes that the value is of type STRING. The seconds one has no quotes, this denotes that it is of type NUMBER. They BOTH should be numbers. typeBugDemo.lua typeBugDemo.miz
Flappie Posted May 7, 2024 Posted May 7, 2024 Perfect, that is all I needed. Thank you! Issue reported. 1 ---
Recommended Posts