Vergleich LUA mit anderen Programmiersprachen

  • #1, z ToxinSaturday, 16. March 2013, 20:52 hodinky 12 years ago
    Hallo,

    Ich Programmiere schon seit 3 Jahren Beruflich, allerdings im Bereich SPS (Automatisierungstechniker).
    Ich wollte mich schon länger mal mit LUA befassen, bin aber nie richtig dazugekommen.
    Jetzt zu meiner Frage:
    Kann man LUA mit Sprachen, wie ST oder AWL vergleichen, oder unterscheiden sich diese Sprachen extrem?
    (Grund: ich hoffe dass LUA der Sprache ST ähnelt, da ich mich sonst wohl nicht reinarbeiten werde)

    Ich hoffe einer von euch weiß bescheid smile

    Danke schonmal an alle, die sich melden!

    TOXIN

    Bažant

    7 Posts


  • #2, z afrlmeSaturday, 16. March 2013, 22:06 hodinky 12 years ago
    ah nice one - I see you are a fellow prop heed (Reason) user wink

    I have no clue if lua is similar to any of the programming languages you have listed but it is fairly simple to use once you get a grasp on the basics!

    there's plenty of examples on here, from myself & other members, available in the lua section of the forum or via the wiki link (on the menu) - I will be adding more examples as I go along & will be adding a beginners guide to lua; to the new Visionaire Studio wiki for the official documentation.

    there are also plenty of tutorials & code snippets for getting started - if you google lua smile

    --*--

    quick example:
    -- let's store a Visionaire Studio condition inside of a variable to use later on!
    local cond = getObject('Conditions[condition_name]'):getBool(VValueCondition)
    
    if cond then
     print('Condition is true!')
    else
     print('Condition is false!')
    end
    

    or we could create a function & call that wherever we like ...
    as an example I will create something similar to the condition example above!
    -- let's store a Visionaire Studio condition inside of a variable to use later on!
    local cond = getObjects('Conditions[condition_name]'):getBool(VValueCondition)
    
    -- let's create a function which will print a positive statement!
    function printPos()
     print('Condition is true!')
    end
    
    -- let's create a function which will print a negative statement!
    function printNeg()
     print('Condition is false!')
    end
    
    -- let's query if the condition is true or false & call the required function for printing the message!
    if cond == true then
     printPos()
    else
     printNeg()
    end
    



    Ich hoffe einer von euch weiß bescheid smile
    --*--
    I hope one of you white people smile


    hmm not sure what to make of bing's translation of the quoted part razz

    Imperátor

    7285 Posts

  • #3, z ToxinSaturday, 16. March 2013, 22:36 hodinky 12 years ago
    Hey,

    Thank you for your fast awnser.
    Yea, I use Reason since V 2.0 and I'm waiting for Reason 7 razz (I'm sure It'll be great, like every update)
    Now back to the topic.

    Thank you about the program examples.
    I know, that i have to learn the commands of LUA (via google), but all in all It looks like ST.
    Thats grate, because It's easier for me to understand the language.
    It's like program an automated production plant with a Beckhoff SPS.
    The only difference is, I can't destroy millions of euros grin

    *That funny sentence normally means:

    "I hope somebody knows about both languages."

    Thank you really much!

    TOXIN

    Bažant

    7 Posts

  • #4, z afrlmeSaturday, 16. March 2013, 22:47 hodinky 12 years ago
    ah right - the translation seemingly comes across sounding somewhat racist wink

    I'm still on Reason 5 but yeah Reason is a really nice daw - I use Presonus Studio One as my secondary.

    I wouldn't worry about lua too much - most things can be achieved in the editor itself without needing to resort to lua - but as I said: there are plenty of examples on here & by searching on google.

    if you need help scripting something or have any issues with a script you are working on - then feel free to ask for some help on here wink

    Imperátor

    7285 Posts

  • #5, z ToxinThursday, 21. March 2013, 18:24 hodinky 12 years ago
    Hey,

    can you please help me with this Problem?
    I want to have a grid, where objects can be placed.
    I tried to program the following description, but i'm failed. razz :

    (description, no program language)

    Load the actually Curser position "y /100"
    delete all after the ","
    set variable "actualygrid"

    Load the actually Curser position "x /100"
    delete all after the ","
    set variable "actualxgrid"

    Set "Object0" to x = "actualxgrid*100" y = "actualygrid*100"

    Can I program with this logic in Lua or Visionaire?
    Or do I have to think different? (logic like a program in ST)

    And is there any option to see the variables (Var1Bool = true or False bzw. Var2Int = 1343...usw) while the Game is running?

    I'm sorry about my inability...

    TOXIN

    (I also hope you can understand my bad english razz)

    Bažant

    7 Posts

  • #6, z Retrogame-FanThursday, 21. March 2013, 19:01 hodinky 12 years ago
    Zum Titel: Visual Basic. Mehr kann ich nämlich nicht.

    Bažant

    59 Posts

  • #7, z BigStansFriday, 22. March 2013, 01:32 hodinky 12 years ago
    Lua ist eine sehr einfach gehaltene Scriptsprache, welche gerade bei Spielen oder auch Engines häufig genutzt wird. Lua bietet eine sehr nahe C implementation und ist dazu sehr schnell smile
    Wenn Du dich mit Visual Basic auskennst, wird Dir Lua anfangs zwar seltsam vorkommen, vergleiche es mit "php".

    Čestný člen

    361 Posts

  • #8, z afrlmeFriday, 22. March 2013, 13:19 hodinky 12 years ago
    Hey,

    can you please help me with this Problem?
    I want to have a grid, where objects can be placed.
    I tried to program the following description, but i'm failed. razz :

    (description, no program language)

    Load the actually Curser position "y /100"
    delete all after the ","
    set variable "actualygrid"

    Load the actually Curser position "x /100"
    delete all after the ","
    set variable "actualxgrid"

    Set "Object0" to x = "actualxgrid*100" y = "actualygrid*100"

    Can I program with this logic in Lua or Visionaire?
    Or do I have to think different? (logic like a program in ST)

    And is there any option to see the variables (Var1Bool = true or False bzw. Var2Int = 1343...usw) while the Game is running?

    I'm sorry about my inability...

    TOXIN

    (I also hope you can understand my bad english razz)


    hmm.

    you could probably do this using the editor itself.

    if you check the wiki you will find a drag & drop example script by "divo" which allows you to drag around images & their polygon object areas & place them where you like on the screen.

    as for being able to see if a condition is true or false you could create a developer interface in which you could assign conditions etc to images so a certain image should display if condition = true or false etc. - I'm not going to go into detail.

    there's also the command/developer console which is accessible via "tab" key (only on games run via the VS editor) but I don't think it allows you to use or check lua.

    Imperátor

    7285 Posts

  • #9, z Retrogame-FanFriday, 22. March 2013, 14:58 hodinky 12 years ago
    Lua ist eine sehr einfach gehaltene Scriptsprache, welche gerade bei Spielen oder auch Engines häufig genutzt wird. Lua bietet eine sehr nahe C implementation und ist dazu sehr schnell smile
    Wenn Du dich mit Visual Basic auskennst, wird Dir Lua anfangs zwar seltsam vorkommen, vergleiche es mit "php".

    Na toll...

    Bažant

    59 Posts