Just Getting started with Lua

This section is for general discussion about Gadgets

Just Getting started with Lua

Postby KWiK » Thu May 21, 2015 12:43 am

I have done a fair amount of VB.net programing in other cad packages but know nothing about Lua. I am starting to look through the examples and documentation, but like most I have to do that in my spare time which there is never nearly enough of.

My first question is, I am wondering if there is any way to step through the code like in VB.net? If not, how do you debug the code other than the dialogs that come up when you run it?

What I have been trying to accomplish and haven't been able to so far is to step through every object on a layer and if it is an object that would contain nodes, then Messagbox or list the locations somehow. There is much more to what I would like to accomplish, but this is my first goal in the program.

I wonder if anyone would be kind enough to give me a kick start. I have used some of the example code to step through objects on a layer, (I think) but when I try to use a messagebox to display their ID I error out.

Thanks for any help.
KWiK
Vectric Apprentice
 
Posts: 92
Joined: Tue May 27, 2014 3:03 am
Model of CNC Machine: ShopSabre

Re: Just Getting started with Lua

Postby Adrian » Thu May 21, 2015 7:23 am

You can use the ZeroBrane IDE.

Once you've installed it open your Lua file and select the menu item "Project/Project Directory/Set from current file"

Remove the require "strict" from the top of the Lua file and put require("mobdebug").start() there.

Select "Project/Start Debugger Server" and when you run the script in Aspire it will break wherever you have a put a break point in your script and allow you to do all the normal inspections you would expect in an IDE.

It's not 100% but it works most of the time.
User avatar
Adrian
Vectric Archimage
 
Posts: 6759
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48

Re: Just Getting started with Lua

Postby KWiK » Fri May 22, 2015 2:56 am

Thank you. I got a little time this afternoon and watched the video's which were helpful, and of course talked about the ZeroBrane IDE. I look forward to trying it next time I have a chance. Unfortunately at home, I only have the trial version loaded and gadgets appear to be disabled in it.

I also scanned through the documentation today, and saw how to step through a contour and get the point2d at at each end of a span. But I didn't see any information on how we could cut a contour at a specific point, like we can with the node edit tool. Am I just overlooking this in the documentation?
KWiK
Vectric Apprentice
 
Posts: 92
Joined: Tue May 27, 2014 3:03 am
Model of CNC Machine: ShopSabre

Re: Just Getting started with Lua

Postby Loonster » Sun Nov 20, 2016 1:56 am

I downloaded ZeroBrane IDE and would like to code within it and later load the completed script(s) into VCarvePro. The question: does VCarvePro use an externally defined graphics library (like LOVE) for generating graphic elements like lines, etc.? Or does Vectric software use proprietary bindings to Lua? Many thanks. Tim Burton
Loonster
 
Posts: 3
Joined: Thu Oct 27, 2016 2:55 pm
Model of CNC Machine: Shapeoko 3 XL

Re: Just Getting started with Lua

Postby Adrian » Sun Nov 20, 2016 10:46 am

All the commands to draw within VCarve are proprietary calls listed in the documentation.
User avatar
Adrian
Vectric Archimage
 
Posts: 6759
Joined: Thu Nov 23, 2006 2:19 pm
Location: Surrey, UK
Model of CNC Machine: ShopBot PRS Alpha 96x48


Return to Gadgets - General

Who is online

Users browsing this forum: No registered users and 2 guests