This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Victor's profile picture

A Question About Lua

Started by Victor, 06 March 2013 - 12:57 PM
Victor #1
Posted 06 March 2013 - 01:57 PM
Hey,

I'm very new to programming and I practically started coding with CC (before I did some minor stuff with BASIC but nah). I've done enough stuff to at least grasp the fundamentals of Lua (basically a remote turtle manager program for CC which works %80 of the time for now and a Pong knockoff with powerups I made with löve2d), and now I want to make a basic scheduler program for windows to help myself maintain my time.

It is not about the program, I'm sure there are very good ones, I just want to make my own. What I ask is, how can I do it efficiently? I know Lua is a scripting language but people wrote full blown applications with it too. I can attempt to write it in love2d but considering that it's a gaming engine/framework, I'm guessing it wouldn't be much efficient. So what is most efficient way to make a very simple windows program with Lua?

TLDR: Want to write a simple windows program with very basic text manupilation features with Lua. Lua is a scripting language, what do?
ShadowedZenith #2
Posted 06 March 2013 - 02:41 PM
You could do it in Lua, but it would POSSIBLY be easier to handle in another language. First you have to ask yourself what all do you want the scheduler to record? Just times, dates and a title? Or do you want it to contain more, like people that are also going to be with you at that time? With Lua, I'm sure you easily could accomplish this in a very simple terminal interface, but I'm not 100% sure if Lua can handle full blown Windows interfaces without some kind of external handler for it, or having to build your own window manually.
lionzNtiggerz #3
Posted 06 March 2013 - 09:13 PM
If I were you, I'd learn python really quick. Because in computercraft, everything is there for you: rednet access, terminal access, colours, etc. But if you start programming in lua outside of computercraft, you're going to need to find out how to do things like draw windows, handle events, etc, etc. And idk, maybe lua makes that easy for you. But i know for a fact that python promotes itself on the basis that it makes all that background stuff easy, and it's pretty similar to lua.

I think you might have to download the lua interpreter for it to work in lua.
Victor #4
Posted 07 March 2013 - 06:10 AM
I already have lua interpreter installed but I don't know how to draw windows interfaces and handle events. As I've said I can use love2d framework but then again I have to manually build windows and text functions from the ground up (as far as I know). The app will be very basic with titles, dates and small notes nothing more. I just don't know how to build a graphical interface with Lua in Windows.

I started learning Java as well, maybe I should just do it in java. I just wanted to know if it's possible only using Lua and if it is, how.
ShadowedZenith #5
Posted 07 March 2013 - 06:18 AM
I'd do it in Java. Java has some really easy classes for handling windows drawing. I would say it is possible, but it'd be easier to find a framework to handle the windows because, while that's good to know how to do, it'd also be a tedious task :P/>
Bubba #6
Posted 07 March 2013 - 07:05 AM
In lua you can use a gui toolkit from here. I would suggest using wxLua, because it is stable and fairly simple once you get used to the syntax. TBH, it is easier to do something simple like this in Lua rather than in Java, but at the same time you should probably do it in Java all the same because it will provide you with a basis in GUI which could come handy some time in the future. Lua is fairly limited in comparison to even native Java libraries.
Victor #7
Posted 07 March 2013 - 10:09 AM
Okay I checked out wxLua and most of the documentation and tutorials are on wxwidgets. Since I don't know C++, following those are quite hard. If I try to learn it only through analysing the samples, it might take a long time. Maybe I should just use Java when I'm proficient enough with it. Having a basis in GUI with Java is bettern than learning wxLua I guess.

Thanks for answers.