Why Lua???

A Small Bit of History and Why:

In the beginning we had basic DOS and it was simple. VB script was sort of like the old basic and made us think we sort of knew what we were doing. This is true, but at the same time we were looking for something that was cross platform. Visual Basic is anything but cross platform. The other feature we were looking for was speed of execution. Visual basic is really slow and was declared legacy software in 2008, so two strikes against VB. We moved onto Python and saw they had a wxPython binding. With the wx frame work this will allow graphics and dialogs to be done within the scripting language. + 1 for Python! We looked at the speed and it was not so good...

 

https://www.machsupport.com/wp-content/uploads/2017/08/VB-226x223.jpg
https://www.machsupport.com/wp-content/uploads/2017/08/Lua-225x224.png

Along came Lua, the little know language from Brazil. We did some testing and it is FAST (+1)! We also found it with the wx binding wxLua(+1). The icing on the cake is that Lua was 100% cross platform (+1). Yeah to say that we were excited was an understatement. We did some google stocking for who was using Lua. We were shocked to see that many games where using Lua because of the need to have a very fast script engine with ultimate control and flexibility.

 

We started coding and testing Lua. We determined after a few hours of programming the syntax was ugly and had a face only a mother could love. The other hard thing, that took a little time at the keyboard, was the use of tables in Lua. If you don’t use tables you are missing one of Lua’s greatest strengths.


Us Giving it a go:

The first idea - make a wizard for Mach4 to drill a bolt hole circle. This example is called “BoltHoleCircle.mcs” and can be found in the Mach4Hobby (or Mach4industrial) / wizards folder. You will see in the header that I did this on 08/03/2013 (time goes by fast). We did this all with the idea that we would not have any editors to make a dialog (also called an IDE). So this dialog was all done with some special functions that use the sizers to layout everything for you.

 

∇ Below is an actual Wizard that is part of Mach4 for calculating the correct feed and speed.

https://www.machsupport.com/wp-content/uploads/2017/07/BoltHoleWizard-277x333.png
https://www.machsupport.com/wp-content/uploads/2017/07/MillFeedandSpeed-280x293.png

 

The power of Lua was starting to show real promise! Soon, the developers we talking about pie in the sky ideas and how it would be nice to have cool little wizards in the screen so that it would be a tool they could use without popping up a window. Also, what if the users could share this and simply pop some code in the screen and not edit any code! This was the start of the Lua Panel! This handy little tool can make wizards show up in the screen as an integrated operator tool. The development team thought that with this much power there will be many cool things thay users will do with this!

 

Ahhhhh!

Some time went by and we made some silly little examples that really where not that great. Then MachMotion contacted us and showed us what they did with the tools we gave them. We were floored! WOW! We asked to look at the code and it was nothing like our original bolt hole wizard. So we did what anyone would do... I asked how they did it 🙂 Enter WXFormBuilder, This is a cool open source project that allows people to design visually and output the language of your choice. Lua is one of the options and it really has saved lots of head banging while trying to make a simple dialog or connect events. In my next blog I will show you how to add some cool engraving to the screen!

https://www.machsupport.com/wp-content/uploads/2017/08/C_Pain-300x200.jpg

Till next time,

We're routing for you, we're all in this together. Keep your stick on the ice..

Mach Development Team