Beginning with LUA

  • #10, by ikarusThursday, 14. August 2014, 09:34 10 years ago
    Well, I think this could become an interesting thread to post little steps and questions for begginers learning LUA with no experience in programming. I'm one of them and there must be more. So, why don't we try to learn together?

    I've begun with the links AFRLme posted, studying basic LUA syntax. The guide about operators is pretty good, but the scripting section of the VS wiki doesn't seem very easy for noobs like me (I don't understand anything), so I'm diving a little into LUA programming, and after that, I'll try to approach LUA and VS. I can't see another easier way to go through it, since there's no path for people like me to go on Visionaire Studio and LUA. I'm not very sure even where to put LUA scripts into the engine...

    I don't know how far I will get into LUA scripts. Maybe I get bored pretty soon or be surpassed, but I'll do what I can. If there's anybody with the same conditions as me, please join me, and this 'adventure' will be better and funnier. I'm a graphic designer, not a programmer, and this is a very hard task for me, like going across the jungle with a little knife...

    Now I'm beggining with the exercises of the blog AFRLme posted. I'll tell the results when it's done. I downloaded LuaEdit 2010 (the name was already suspicious) and even LuaForWindows editors, but I had strange troubles with both. I searched for alternatives and I found an IDE (wich means Integrated Development Environment) called ZeroBrane Studio. It looks good, it works fine -at the moment-, it has a tutorial for begginers, it's user-friendly... and it's free (but you can donate a free amount of money to support the creators if you want).

    That's all by now. Please, share your experiences beggining with LUA. We can make it.

    See you on the road.

    Newbie

    37 Posts


  • #11, by afrlmeThursday, 14. August 2014, 12:05 10 years ago
    @ Ikarus: I have just downloaded a new editor called "Atom" it's by the people who developed gitHub. I would recommend using Sublime Text as it's probably the best text editor available but unfortunately unlike LuaEdit2010 & SCiTE, it doesn't allow you to run the script & print messages to the log. I tried installing a plugin for it which works to a degree but is very buggy.

    Atom on the other hand after installing a few modules is almost same as sublime with a few additional features, but currently lacks my favorite feature which saves all open tabs & content to memory on exit (even if it crashes) & that included tabs that I have not even saved as a file. If Atom added that feature then I would probably jump ship as it is an open source program unlike sublime which is around €80 for a license per version.

    I was actually considering updating the basics section with more stuff. From the basic operators, to some of the math functions, an introduction to tables & some basic accessing & manipulating of the Visionaire Studio data structure tables.

    Accessing VS data structure tables is quite simple once you get used to what sort of table it is you are accessing...

    For instance if a table type says "t_link" then it will either be getLink or getObject depending on whether the table belongs to game or another table.
    -- get current active character (game table)
    game:getLink(VGameCurrentCharacter)
    
    -- get a specific character (direct access)
    getObject("Characters[Ikarus]")
    

    Imperator

    7278 Posts

  • #12, by ikarusThursday, 14. August 2014, 14:20 10 years ago
    I've used Sublime Text to write a few HTML, CSS & JavaScript in the past and I like it, but, as you say, the problem is that you can't run LUA scripts to see the log. By the moment, I'll continue with ZeroBrane as long as it works well. I don't need any special feature or module. I prefer simple things because I'm not an expert, just write code and run (I'll remember to save wink ).

    Newbie

    37 Posts

  • #13, by afrlmeThursday, 14. August 2014, 14:25 10 years ago
    I downloaded zerobrane to test out the remote debugging function David added to vs 4.0. But I haven't used it for anything else.

    Imperator

    7278 Posts

  • #14, by ikarusThursday, 21. August 2014, 11:11 10 years ago
    Well, I see two options:

    A) Nobody is reading this.
    B) Nobody is interested in learning Lua.

    Anyway, I studied the 'lessons' here and it's very useful, but I didn't understand all the stuff (for example, I couldn't understand ipairs function). It's incredible, but it seems Lua is one of the most difficult languajes to find easy ways to be introduced in. There are lots of specialized sites at teaching programming skills in funny and interactive ways, like Codecademy, but none of them have Lua. You can try HTML, CSS, JavaScript, PHP, Python, Ruby, Java, ObjectiveC and even exotic frameworks and other languajes... but not Lua. I must learn Lua by the old & hard style. For you, programmers, this could be a ridiculous speech, but for me this is bad news.

    Ok, I'll keep trying and commenting evolution.

    Newbie

    37 Posts

  • #15, by afrlmeThursday, 21. August 2014, 12:40 10 years ago
    hehe.

    I found lua script to be a little illogical at first also.

    First lesson: Lua is not an acronym, or abbreviation. It is simply lua, which means moon in Portuguese.

    Once you understand the basics & the syntax of the Visionaire Studio data structure tables then you will find it's a lot simpler than you think. It's certainly no Visual Basic for simplicity, but easy enough to pick up, even if you've dabbled in basic html web code.

    I liked the phailed.me blog, it has some nice & easy to follow explanations & examples, & it even gives you a list of things to try doing with what you have learned thus far - if you have been going through each section from the first one.

    If you want complicated then you should look at the openGL code. The documentation for that is very limited & what little there is makes no sense. I get general idea of what some things are for/do, but it's unlikely I'll ever be able to write my own custom shader scripts unless I learn C.

    If you want a fun & interactive way of learning lua - well sort of - then I suggest installing the löve2d game engine framework, sublime text 3 (paid or evaluation - evaluation is indefinite) & adding the build script listed on their wiki & then have a go at some of their basic tutorials. When you hit ctrl+b or select build in the menu, then it will build whatever you have written into a workable.exe file. It's quite fun.

    Check it out here: http://love2d.org - there's no IDE like VS for the engine, you have to work in a text editor.

    Finally: I have begun working on a basic guide to Lua script myself, with simple explanations, code snippets & screenshot of what I wrote in sublime text & what was printed to the console log when I hit build.

    http://wiki.visionaire-tracker.net/wiki/Basic_lua -- this is old page at the minute & needs replacing with introduction text & an index of what I will be covering, plus links.
    http://wiki.visionaire-tracker.net/wiki/Basic_lua:_Operators -- this is only page I've written so far & is currently missing the mathematical operators.

    Imperator

    7278 Posts

  • #16, by ikarusThursday, 21. August 2014, 12:47 10 years ago
    Thanks, AFRLme. It seems you are the only light in my tunnel. smile

    Newbie

    37 Posts

  • #17, by afrlmeThursday, 21. August 2014, 12:49 10 years ago
    just found this interactive online framework. http://moonshinejs.org

    I might see if I can implement it into the wiki somehow. -- edit: or not! don't think it will work.

    Imperator

    7278 Posts

  • #18, by MachtnixThursday, 21. August 2014, 16:16 10 years ago
    Well, I see two options:
    A) Nobody is reading this.
    B) Nobody is interested in learning Lua.


    *lol* Not quite correct.
    A) First Visionaire should work properly
    B) Currently I solve my problems with the editor actions
    but
    C) I would learn LUA if it's useful to solve bigger problems... ;-)

    Machtnix

    Thread Captain

    1097 Posts

  • #19, by afrlmeThursday, 21. August 2014, 17:33 10 years ago
    Each to their own methods - there's always multiple approaches to solving something in vs.

    In regards to VS should work properly... Aye would be nice but a lot of the editor bugs are WxWidget related & nothing much can be done about that until another version of WxWidgets is released, which hopefully addresses various issues with the current version.

    & anything not working action wise in games is probably an overlooked bug or mistake made by the devs. A lot of stuff has been replaced or edited since 3.7.1 to 4.0.1 & with each fix, edit, or new feature something else decides to go kaput! razz

    Anyway: I've finished the lua operators page. I'm working on the introduction/index page now & then will begin working on the types (string, integer, variable, etc) page.

    Imperator

    7278 Posts

  • #20, by MachtnixThursday, 21. August 2014, 18:42 10 years ago
    For my next game (if Visionaire works and after I bought it.... ;-), I want to make some side quest characters (Nebencharakter) automatically walk. Now it's impossible, because I have only one way system per scene (Wegesystem) for all my characters. I can't determinate how they cross each other on the floor.

    2nd: I can't move my character up and down (in my testgame I used a flying robot 2 Meters above the floor, so he crosses other characters without tangle), but he can't move down without changing its fixed movement center in the animation studio. The results are outfits with different coordinate centres of the same robot. I think that's all problems LUA can help.
    But that's still a long way off.

    Machtnix

    Thread Captain

    1097 Posts