Hello Guest it is April 26, 2024, 08:18:39 PM

Author Topic: How to get Input0 User Description from lua?  (Read 453 times)

0 Members and 1 Guest are viewing this topic.

How to get Input0 User Description from lua?
« on: October 07, 2022, 03:42:57 AM »
How to get Input0 User Description from lua?
I couldn't find a suitable function for this.
Re: How to get Input0 User Description from lua?
« Reply #1 on: October 07, 2022, 05:16:34 PM »
Hi,
I think that field if for human benefit only. That is to say you can put a description like "probe wire, red with black stripe, fourth screw terminal from the right". It is simply for your benefit
so you can recall the nature of the signal many months or years down the track.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: How to get Input0 User Description from lua?
« Reply #2 on: October 14, 2022, 12:38:28 AM »
Yeah, that user description is the poor/lazy man's wiring diagram.  :)  It was added in way after the fact, so it is kind of bolted on.  You can read the Machine.ini with mc.mcProfileGetString(inst, "Signal1", "UserDesc").  The section "Signal1" is derived by concatenating the word "Signal" with the signal id that you are interested in. 
Code: [Select]
local userDesc, rc
local section = "Signal" .. tostring(mc.ISIG_INPUT0)
userDesc, rc = mc.mcProfileGetString(inst, section, "UserDesc")
if (rc == mc.MERROR_NOERROR) then
    -- userDesc is valid.
end

Steve