Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: cncman172 on March 28, 2016, 10:23:51 AM
-
Hey Gang,
I have tried for the last few weeks to get things to work in LUA and it is challenging. I can get some very basic code to work but I decided to try the pendant code under examples and each time the code hits
the third line of code in the main() program where it sets the color I get the error below. Anyone have any idea what I might be doing incorrectly? Thanks
Russ
function main()
panel = mcLuaPanelParent;
mc.mcCntlSetLastError(0, 'panel is parent!!!');
panel:SetBackgroundColour(wx.wxColour(255,255,255));
**********************
mcLua ERROR: Lua: Error while running chunk
[string "C:\Mach4Hobby\LuaExamples\Pendant Project\Mai..."]:58: attempt to index upvalue 'panel' (a nil value)
stack traceback:
[string "C:\Mach4Hobby\LuaExamples\Pendant Project\Mai..."]:58: in function 'main'
[string "C:\Mach4Hobby\LuaExamples\Pendant Project\Mai..."]:382: in main chunk
mcLua ERROR: Lua: Error while running chunk
Debug session finished.
-
You cannot access the mcLuaPanelParent from a debug session its impossible as the panel parent is the main gui, the main gui is disabled whilst in the editor.
DazTheGas
-
Daz,
Thanks for responding when I put all the code shared in its own panel and just tried to run it it gave the exact same error.
Russ
-
Heres a snippet from one of my panels if it helps
DTG = {}
DTG.panel = nil
DTG.panel = mcLuaPanelParent;
local window = DTG.panel:GetParent();
window:SetBackgroundColour(wx.wxColour(153,180,209));
window:Refresh();
local wsize = window:GetSize();
DTG.panel:SetSize(wsize);
DazTheGas