Hello Guest it is March 29, 2023, 12:03:52 PM

Author Topic: Is there a bug with mc.mcProfileGetDouble()?  (Read 1271 times)

0 Members and 1 Guest are viewing this topic.

Is there a bug with mc.mcProfileGetDouble()?
« on: March 17, 2018, 10:20:09 PM »
What am I missing here? I'm trying to use mc.mcProfileGetDouble() and the default value is a fractional value. I get back a numeric value of zero. The API docs claim it should return the existing value or the default value if the property doesn't exist.

Code: [Select]
hgProbing.params = {
   ...
   ['StepOffDistance'] = math.abs (mc.mcProfileGetDouble (inst, 'hgProbing', 'StepOffDistance', 0.5)),
   ...
}

I have to do an explict mcProfileWriteDouble() to get it to work. Now when I do the mcProfileGetDouble () returns the expected value of 0.5.

This looks like a bug with mcProfileGetDouble(). Can anyone confirm?


-Freeman
I'm not a complete idiot...
    there are some parts missing.
Re: Is there a bug with mc.mcProfileGetDouble()?
« Reply #1 on: March 18, 2018, 12:10:58 AM »
Hi,
haven't tried it so can't really help, although I have a question.

Is 0 not a value? The way I read it is that if the value does not exist ie null then it would return your default.

Craig
My wife left with my best friend...
     and I miss him!
Re: Is there a bug with mc.mcProfileGetDouble()?
« Reply #2 on: March 18, 2018, 12:25:10 AM »
Is 0 not a value? The way I read it is that if the value does not exist ie null then it would return your default.

Yes in this case 0 is a value, but not the one the API docs suggest should be returned. If you supply 0.5 as the default value, and the Section/Key doesn't exist in the profile, it is suppose to return 0.5 not 0. I deleted the section using mcProfileDeleteSection() to make sure it didn't exist.

I'm not a complete idiot...
    there are some parts missing.
Re: Is there a bug with mc.mcProfileGetDouble()?
« Reply #3 on: March 18, 2018, 12:34:48 AM »
Hi,
I haven't encountered that however I haven't tried it either.

Certainly sounds fishy that you can delete a section and yet get a numeric, albeit 0, return.

I have on a few occasions found myself thinking that I've found a Mach4 bug only to be given an explanation as to its behavior and while that may be
quirky its not a fault.

Craig
My wife left with my best friend...
     and I miss him!