Tutorial LUA Part 1: Terms and Strings v1.2

Discussion in 'Starbound Modding' started by The | Suit, Oct 1, 2014.

  1. The | Suit

    The | Suit Agent S. Forum Moderator

    All my tutorials are actually in the Modding Guides announcements ( the relevant updated tutorials anyway )
    Last edited: Jan 12, 2015
    DarthTrethon and Katzeus like this.
  2. DarthTrethon

    DarthTrethon Spaceman Spiff

    Ahh ok, I hope they add this one and the next two in there as well.....not seeing this on in there yet.

    Nevermind, it's there.
  3. I Said No

    I Said No Cosmic Narwhal

    Got a question, but I don't know if it really warrants its own thread.
    When you create a function, what hierarchy is it placed under? For example, i've made LUA scripts for some of my objects, like the Advanced Furnace. Are functions in advanced_furnace.lua available only to the furnace, or all objects? Is there a way to make a function so that all objects could access it?
  4. It will be only for that object. If you want it so that all objects can access that function, place it in a separate lua file and include it in the scripts array for each object that you want to be able to access the function.

    There is no way to have every object in the database able to access some arbitrary function (AKA A global script/function).
    Dunto likes this.
  5. The | Suit

    The | Suit Agent S. Forum Moderator

    Just to add a little more, when severedskullz says script array inside the object file you will see
    "scripts" : [ "/objects/wired/landmine/landmine.lua" ],
    You can add as many scripts as you want
    "scripts" : [ "/objects/wired/landmine/landmine.lua",
    /objects/wired/jump/jump.lua" ]
    So the object utilizes it
    severedskullz and Dunto like this.
  6. I Said No

    I Said No Cosmic Narwhal

    Ah ok, thanks! That never occurred to me, haha.
  7. MasterofKittens

    MasterofKittens Subatomic Cosmonaut

    Shouldn't this be a LUE tutorial? But seriously, this is awesome. I'll have to look at it in depth later.
    The | Suit likes this.
  8. The | Suit

    The | Suit Agent S. Forum Moderator

    I will try and add some more universe and everything to part 3 :)
    AstralGhost likes this.
  9. The | Suit

    The | Suit Agent S. Forum Moderator

    CHANGELOG v1.1

  10. The | Suit

    The | Suit Agent S. Forum Moderator

    Version 1.2 Update

    Added a small code snippet example for string handling which can have ingame applications (except for the print part - which is just to see it in action for online interpreters)

    test = "reefpodH_sbno"
    i, j = string.find(test, "H_sbno")
    g = string.sub(test,0,i-1)
  11. blahblahdrugs

    blahblahdrugs Star Wrangler

    Just my 2 cents for improvement on an already great guide: Perhaps providing some examples of situations where each snippet of information would be useful in relation to creating useful mod applications would help people wrap their heads around the information better. Like when a child is learning addition you show them places where it might be useful in addition to how it works.
  12. The | Suit

    The | Suit Agent S. Forum Moderator

    The practical application will be part of part 3.
    Which is currently in limbo since one of our writers have gone M.I.A

    Though will deffinetly looking into finishing it up as soon as possible.
  13. blahblahdrugs

    blahblahdrugs Star Wrangler

    That would be excellent but it may be more useful here and as you go along.

    Maybe I'm a bit slow but as a beginner with a little bit of coding experience in other languages I found the subject matter kind of difficult to wrap my head around. As someone who wants to just jump into modding feet first I found myself asking while reading "How can I apply this right now?" and "Why is being able to modify strings in so many different ways so important when modding Starbound?"

    I hope this criticism doesn't make you think I am unappreciative; I just hope that you (as the teacher) can use my (as the student) impressions to help out more idiots like myself. @.@
  14. The | Suit

    The | Suit Agent S. Forum Moderator

    No issues I always accept all forms of criticism.
    The biggest issue is you have coding experience, so you have foundations set.
    For other users they need some ground work before getting their feet wet.

    Part 3, will be more for you since it starts with the basics in an example basis.
    Till then though feel free to see a few small code projects which use the tutorials as a reference
  15. blahblahdrugs

    blahblahdrugs Star Wrangler

    Thanks! I do have it I've looked through it a little bit already it's an excellent resource. Is part 2 out already?
  16. The | Suit

    The | Suit Agent S. Forum Moderator

  17. KichiK

    KichiK Void-Bound Voyager

    Correct me if I'm wrong, but this is a mistake.

    EDIT: Didn't notice the space when I was looking at it in tutoprial, my bad,
    Last edited: Dec 15, 2015
  18. Jonesy

    Jonesy Sarif's Attack Kangaroo Forum Moderator

    Stay on-topic, please.

Share This Page