Hello Guest it is March 28, 2024, 01:43:50 PM

Author Topic: lua error while running chunk  (Read 1188 times)

0 Members and 1 Guest are viewing this topic.

lua error while running chunk
« on: October 04, 2020, 05:36:27 PM »
new to this stuff. 490 refers to the word 'buttonEnable'. i tried to deleting the line and the error is still there
Re: lua error while running chunk
« Reply #1 on: October 05, 2020, 11:20:06 AM »
Does this error occur on startup or when you press the enable button?
Re: lua error while running chunk
« Reply #2 on: October 05, 2020, 12:43:09 PM »
It does it during startup
Re: lua error while running chunk
« Reply #3 on: October 05, 2020, 12:44:47 PM »
I have another question I could not seem to get the error message to go away no matter what by changing a few things on the script so my question is should I redownload the whole mach4 in that case I will have to repopulate all my inputs and outputs or is there an easier way to redownload and still save all my settings
Re: lua error while running chunk
« Reply #4 on: October 07, 2020, 12:21:23 PM »
The ButtonEnable function is defined upon loading and is not related to a specific button but rather checks the 'AxisTable' table for pairs.  I would think that because the function is nil that there is a problem with your install of Mach4 Lua files.  You could copy your current Profile to another directory and reinstall, then copy the profile back and see if you get the same error code.

Did you make any changes to the screen you are working with? 
I assume you have created and are using a new profile based on the mill profile and done the same with the screen set you are using.  If not then installing over the existing ones will negate all changes you have made.

HTH

RT



---------------------------------------------------------------
-- Button Enable function Updated 11-8-2015
---------------------------------------------------------------
function ButtonEnable() --This function enables or disables buttons associated with an axis if the axis is enabled or disabled.

    AxisTable = {
       
  • = 'X',
  • [1] = 'Y',
            [2] = 'Z',
            [3] = 'A',
            [4] = 'B',
            [5] = 'C'}
           
        for Num, Axis in pairs (AxisTable) do -- for each paired Num (key) and Axis (value) in the Axis table
            local rc = mc.mcAxisIsEnabled(inst,(Num)) -- find out if the axis is enabled, returns a 1 or 0
            scr.SetProperty((string.format ('btnPos' .. Axis)), 'Enabled', tostring(rc)); --Turn the jog positive button on or off
            scr.SetProperty((string.format ('btnNeg' .. Axis)), 'Enabled', tostring(rc)); --Turn the jog negative button on or off
            scr.SetProperty((string.format ('btnZero' .. Axis)), 'Enabled', tostring(rc)); --Turn the zero axis button on or off
            scr.SetProperty((string.format ('btnRef' .. Axis)), 'Enabled', tostring(rc)); --Turn the reference button on or off
        end
       
    end