35
« on: July 24, 2015, 05:42:29 PM »
I posted this in another thread but wanted to bring it to the top to see if anyone could help.
We have a need to have Mach make a serial connection and send and receive serial data.
I'm new to Lua but have done a little vb developmet. I've done only a couple of things that required serial com.
I searched through as much documentation as I could find in the forums with no luck (Special thanks to Scott “Poppa Bear” Shafer and Ya-Nvr-No)
McLua mc Scripting Reference SpacedOut
McLua Work Offsets and Parameters1
Pound Var List-revised1-2
Mach4 Scripting Manual
Mach4 ENUM list for mc1
Mach4 ENUM list for mc1
I installed the "Lua for windows" package which comes with the luars232.dll. I ran the example for the luars232.dll and was able to make a connection to my com ports on my machine.
I tried to do the same thing in mach4 by placing the dll in the Mach4Hobby folder (the root folder is in the PATH). I then created a new Lua script (tim.lua) and wrote the following:
rs232 = require("luars232")
This was the result:
Compilation successful!
Output: "C:\Mach4Hobby\LuaExamples\Tims.mcc"
Waiting for client connection...
Client connected ok.
At Breakpoint line: 1 file: C:\Mach4Hobby\LuaExamples\Tims.lua
mcLua ERROR: Lua: Error while running chunk
error loading module 'luars232' from file 'C:\Mach4Hobby\luars232.dll':
The specified module could not be found.
stack traceback:
[C]: in ?
[C]: in function 'require'
[string "C:\Mach4Hobby\LuaExamples\Tims.lua"]:1: in main chunk
mcLua ERROR: Lua: Error while running chunk
Debug session finished.
It "Seems" to want to load but gets hung up somewhere. It could definitely be pilot error on my part as I do have some coding experience but far from an expert...
A simple, documented example would be the greatest help but I am more than happy to dive in to any doc that has the answer.
Thanks
-Tim