Creating Desktop Apps with Lua - [alpha preview]
Apple is blurring the difference between the MAC OSX and iOS, to the extent that the new iOS devices are nearly as powerful as the low end Macs. The API's are being made as compatible as possible. The iTunes App Store and the Mac App Store (MAS) both are doing well for developers to make a living. However the barrier to many still remains understanding and learning Objective-C.
While objective-C, being a C variant seems complicated despite the fact that it is quite verbose and descriptive. A lot of developers would love to use a simpler and forgiving language than bother with the fact that a number is represented in several ways in Objective-C which could range from being an int, float, double, long (C types) to NSInteger, etc. Whatever happened to a = 5, b = 4.5 and c = a + b?
This is where a favorite language of mine comes into play. Lua is a scripting language like VBScript / Visual Basic for Applications was. It is much simpler than Python and JavaScript as it is forgiving with white space and semi-colons, imagine writing a javaScript without semi-colons or not indenting statements in python or worse writing readable code with perl.
So working with CoronaSDK, GiderosStudio, Moai, MarmaladeQuick, etc the glue was Lua scripting, while everyone is focusing on mobile development alone, there are fewer and fewer frameworks and tools for creating desktop apps with Lua. There is talk fr a very long time about making such options available. There have also been many options available to embed/integrate Lua into your own apps. So you can find things like tolua, tolua++, swing, LuaCocoa, LuaBridge, etc. In fact one developer who had worked on LuaCocoa and who also worked for a popular Lua Mobile Framework SDK was working on a desktop app created with Lua, but for reason known to them alone, they shelved that project for over 1 year.
While the new platforms look alluring on desktops, there is still no option that exists using Lua. So while working on some plug_ins for Gideros Studio, I was experimenting with Lua and Cocoa. It is not that difficult to create a non-gaming app using Lua and Cocoa. While I am not competing with any of the frameworks to create yet another framework, it is an interesting experiment that taught me a lot more about the Lua (everyday is a learning) it could be a matter of time when I could use it to create an IDE that can run, write, compile and publish apps all from within the IDE and using Lua. The next step of the experiment is to see if this can be extended to be cross-platform and compatible with Windows 8 (Visual Studio).
It is not the time to rejoice as there are much better implementations of Lua to perform a task, however when you try to make something that is generic and will change based on the choices made by the user, it is slightly more difficult. Creating dynamic controls, classes, events, etc.
This has also explained how and why the daily builds and new releases throw out chunks of code and force new options. Each iteration that makes things run more efficient enforces a code and API change. It becomes a very big ball of tangled code pretty fast.
Back to the experiment, here's sample code of what I've been testing
and here's a video to see the same
Update: Blogger mucked up the video to a very poor quality video, I might upload that to YouTube and link a better quality one here.
Hope that the frameworks integrate desktop compiling into their SDK...
While objective-C, being a C variant seems complicated despite the fact that it is quite verbose and descriptive. A lot of developers would love to use a simpler and forgiving language than bother with the fact that a number is represented in several ways in Objective-C which could range from being an int, float, double, long (C types) to NSInteger, etc. Whatever happened to a = 5, b = 4.5 and c = a + b?
This is where a favorite language of mine comes into play. Lua is a scripting language like VBScript / Visual Basic for Applications was. It is much simpler than Python and JavaScript as it is forgiving with white space and semi-colons, imagine writing a javaScript without semi-colons or not indenting statements in python or worse writing readable code with perl.
So working with CoronaSDK, GiderosStudio, Moai, MarmaladeQuick, etc the glue was Lua scripting, while everyone is focusing on mobile development alone, there are fewer and fewer frameworks and tools for creating desktop apps with Lua. There is talk fr a very long time about making such options available. There have also been many options available to embed/integrate Lua into your own apps. So you can find things like tolua, tolua++, swing, LuaCocoa, LuaBridge, etc. In fact one developer who had worked on LuaCocoa and who also worked for a popular Lua Mobile Framework SDK was working on a desktop app created with Lua, but for reason known to them alone, they shelved that project for over 1 year.
While the new platforms look alluring on desktops, there is still no option that exists using Lua. So while working on some plug_ins for Gideros Studio, I was experimenting with Lua and Cocoa. It is not that difficult to create a non-gaming app using Lua and Cocoa. While I am not competing with any of the frameworks to create yet another framework, it is an interesting experiment that taught me a lot more about the Lua (everyday is a learning) it could be a matter of time when I could use it to create an IDE that can run, write, compile and publish apps all from within the IDE and using Lua. The next step of the experiment is to see if this can be extended to be cross-platform and compatible with Windows 8 (Visual Studio).
It is not the time to rejoice as there are much better implementations of Lua to perform a task, however when you try to make something that is generic and will change based on the choices made by the user, it is slightly more difficult. Creating dynamic controls, classes, events, etc.
This has also explained how and why the daily builds and new releases throw out chunks of code and force new options. Each iteration that makes things run more efficient enforces a code and API change. It becomes a very big ball of tangled code pretty fast.
Back to the experiment, here's sample code of what I've been testing
resize (800, 200) --- this resizes the window to these dimensions position(displayWidth/2, displayHeight/2) --- positions the window to the new positions setTitle("A very long title set from the script") --- changes the title of the window --- Note the screen size is already saved as displayWidth and displayHeight variables print("Desktop Size: " .. displayWidth .. " x " .. displayHeight) -- show an alert local result = alert("My Lua App", "Hello from lua code", "OK", "Quit") print("Chosen: ", result) if result == 1 then quit() --- exit the app end
and here's a video to see the same
Update: Blogger mucked up the video to a very poor quality video, I might upload that to YouTube and link a better quality one here.
Hope that the frameworks integrate desktop compiling into their SDK...
Comments
Post a Comment