How to apply Lua?

So random question, not quite Achaea specific. 

I developed a minigame that runs off of tells received by the players. It's fairly extensive, but I'm still kind of a beginner with programming knowledge/application. 


The question is what could I do to create a website version of the game with my Lua?


I'd probably forgo the typed commands and add graphical buttons like 'Buy Soldier' and so on. 

I guess ideally I'd want to make it so there's a lobby and two people can challenge each other and that'll load a fresh game. I know how to code those features except integrating with servers and webspace/etc. Thoughts?

I like my steak like I like my Magic cards: mythic rare.

Comments

  • I'd just port the code to javascript. Syntactically the languages are very similar and most of it shouldn't be very difficult to port. Also it makes for a good excuse to learn another programming language (and a widely used one at that).

    https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md#javascript

    You could look into Angular.js which is a js framework that specializes in making simple single page apps. Pretty sure the link I posted above has angular tutorials as well.

                   Party right, party hard,

                                            Sing and dance, perfect bard.

                                                                     Prefarar loop, accentato whore,

                                                                                             Buy a new rapier, get nerfed some more.

  • edited January 2014
    If you'd like to keep the scripts server side, you could also look into CGILua. It'd work pretty much like PHP.

    I haven't fiddled with it myself yet though.

    EDIT: Looking a bit more, looks like CGILua is no longer supported. owever the Orbit project already got updated this year.
  • There's Kepler maybe?
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • By the by, if you can write Lua, it's not a stretch to move to PHP/javascript/perl.
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • There are a bunch of nice web frameworks that popped up for Lua recently:

    http://moonstalk.org/ (in development)

    A fair bit of these are overkill for what you'll need, but the list would be helpful to others who read this. The list is incomplete, there is another one I can't find.
  • Trevize said:
    By the by, if you can write Lua, it's not a stretch to move to PHP/javascript/perl.
    Learning multiple languages is the best way to get the general concept of programming down! Or... at least... it's the way I did that, which means it is at least the best way!
  • I agree that the general programming concepts are similar (across types of languages... procedural vs functional is a good bit of difference (yes with some common bits)), but I also realize that you will not be a good programmer in whatever new language you pick up just because you figure out the subset of syntax you need to do your job. You've got to learn the language, its philosophy, tips & tricks before you'll become good at it. Otherwise you'll simply be mediocre and the code with the style of another language in this will be horrendous and possibly inefficient.
  • As someone who learned to program by playing around with a plethora of different languages, I agree with Vadimuses. Writing programs in a language doesn't really mean you know how to program (idiomatically) in that language, and if you can't write good code in at least one language, you can't really be a good programmer.

    I'm a big believer in programmers trying out lots of different languages, if only to teach them to think in terms of different abstractions and to overcome the blub paradox. But I don't necessarily think that's the best to learn to program, become a good programmer, or nourish a new found joy of programming.

    For newcomers, I'd recommend picking up a language that's easy to make things in and just keep using it. You'll be picking up a skill that you'll with time become good at, and you'll be able to actually make things to motivate yourself to keep learning.

                   Party right, party hard,

                                            Sing and dance, perfect bard.

                                                                     Prefarar loop, accentato whore,

                                                                                             Buy a new rapier, get nerfed some more.

  • My coding's become less redundant over time. My game is a script that's about 1500 lines with nesting.
    Is it more or less pro to keep doing nesting or just kind of depending on the complexity of a particular function and the programmer's preference?
    Just kind of wondering how to measure how many "lines" of code I've actually done if there's a standard for that measurement.
    I like my steak like I like my Magic cards: mythic rare.
  • How many different functions are in those 1500 lines and how many nesting levels are you in?

    There is no rule but given some rough data we could tell you if you're doing it right or wrong...
  • Vadimuses said:
    I agree that the general programming concepts are similar (across types of languages... procedural vs functional is a good bit of difference (yes with some common bits)), but I also realize that you will not be a good programmer in whatever new language you pick up just because you figure out the subset of syntax you need to do your job. You've got to learn the language, its philosophy, tips & tricks before you'll become good at it. Otherwise you'll simply be mediocre and the code with the style of another language in this will be horrendous and possibly inefficient.
    I agree completely. It's the logical outlook that helps a -lot- though. Not even into programming concepts, but back to a basic logical outlook.

    That, and php/lua/javascript/other scripting languages are much more similar than programming languages, though yes, each has its own way and better ways of doing things.
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • http://pastebin.com/A80Hy3ZR

    An example of 3 functions. Also the three types of units I have each has about 20 traits, with each trait on a line defining that trait. So for that and the game settings each thing is a line.
    Thoughts?

    (also yeah this thread is 10 months old)
    I like my steak like I like my Magic cards: mythic rare.
Sign In or Register to comment.