Page 1 of 1

Lua programming

Posted: Sat May 10, 2014 2:00 pm
by Morzan
Hello everyone!

So i've been playing with ComputerCraft, which is a mod for Minecraft. And if i remember correctly Factorio is programmed in Lua. And ComputerCraft also uses Lua for programming. My only problem with ComputerCraft is limitation. So i looked around in the internet for a way to run things from the Lua source code. I was not able to do so, i would like to get some help from you guys (mainly developers and modders).

Re: Lua programming

Posted: Sat May 10, 2014 7:37 pm
by FreeER
Morzan wrote:And if i remember correctly Factorio is programmed in Lua
Just because it makes a difference, Factorio is programmed in C++ and it has a Lua modding interface/API... In comparison to ComputerCraft which is (I assume since it's for Minecraft) programmed in Java and has a Lua interface/API (and almost certainly a Java API as well, for other Minecraft mods)

Just to be clear, are you wanting to know a way to run 'things' from Lua source code in Factorio mods or in CC? And do be a little more specific about 'things' so that people have a better idea of exactly what you need information about :)

I'll assume in CC, so... I haven't used CC in a long time (because I haven't played Minecraft... in over a year? wow) and I never did anything particularly complicated so I may not be able to help you, but if you provide more info it's possible that someone else may be able to.

Re: Lua programming

Posted: Sat May 10, 2014 8:49 pm
by Morzan
Well i want to run "things" from Lua source code. But not in CC because i feel it a little bit limited but also a little bit easier. So i want to try out myself how good i could be with Lua itself.

And i'm thinking about doing a strategy game (pretty much CnC style) with Lua. (By the way my longest CC program is about 500 lines long + an api i wrote which is only 100 lines long)

So my problem is that i can't find pretty much anywhere a good explanation on how to install a Lua developer envinronment. Because i think i can code without the CC's added APIs (for example: term API) and try to make programs that work without a Minecraft instance with CC installed or a CC emulator. (Big sorry for not being clear, i was a little bit tired when i wroted the first post)

Re: Lua programming

Posted: Sat May 10, 2014 9:29 pm
by ssilk
Speed difference between lua and c++ is between factor 10 and 100...

Not very relevant, but interesting:
http://onlyjob.blogspot.de/2011/03/perl ... a-tcl.html

Re: Lua programming

Posted: Sun May 11, 2014 4:09 am
by BenWo
If you're looking to write a game in LUA, you probably want to check out Love2D.

Re: Lua programming

Posted: Sun May 11, 2014 8:30 am
by Morzan
BenWo: Thank you very much! I guess i'll have to learn how LÖVE is actually working and everything, but i like it! :) ssilk: Probably you're right, but i'm only 15 years old and for me Lua right now is enough.

Re: Lua programming

Posted: Sun May 11, 2014 8:38 am
by BenWo
Morzan wrote:BenWo: Thank you very much! I guess i'll have to learn how LÖVE is actually working and everything, but i like it! :) ssilk: Probably you're right, but i'm only 15 years old and for me Lua right now is enough.
No problem! If you just follow the tutorials for Love you can have a basic game window displaying a sprite in minutes. And once you get the basics it's simply a matter of experimenting!

I learned Lua through using ComputerCraft myself, so good luck. :D

Re: Lua programming

Posted: Sun May 11, 2014 12:36 pm
by ssilk
Morzan wrote:ssilk: Probably you're right, but i'm only 15 years old and for me Lua right now is enough.
Sweet.
Not kidding: maybe you should begin to think a little bit bigger, cause you will be never be so young then yet and will never learn so easy like now. :)

Re: Lua programming

Posted: Sun May 11, 2014 4:16 pm
by FreeER
ssilk wrote:
Morzan wrote:ssilk: Probably you're right, but i'm only 15 years old and for me Lua right now is enough.
Sweet.
Not kidding: maybe you should begin to think a little bit bigger, cause you will be never be so young then yet and will never learn so easy like now. :)
I'd like to somewhat support this! Feel free to start with Lua but if you do get the time to learn other programming languages (Java, Python, D, C++, C, Perl, PHP etc.) do so! It'll be a bit easier for you now than later and once you learn one or two you'll be absolutely amazed at how quickly you can learn others :) (not to mention amazed that so many people allow others to control their computing experience :lol:)

Re: Lua programming

Posted: Tue May 13, 2014 2:57 pm
by Morzan
Okay,okay i'll start those a little bit later. I do programming a little bit everyday, so i learn slowly but surely. But summer is coming so i'll speed up! :)
BenWo wrote: No problem! If you just follow the tutorials for Love you can have a basic game window displaying a sprite in minutes. And once you get the basics it's simply a matter of experimenting!

I learned Lua through using ComputerCraft myself, so good luck. :D
Thanks! So far i do pretty good after reading a tutorial from the wiki. And i now understand what callbacks mean. It was weird for me when i first saw it but now i see the potential in it! :)