Best way to use a delay in Lua?

  • #1, by sebastianMonday, 28. May 2018, 21:36 2 years ago
    Hello there,

    long time since i started a topic.
    Currently i need to use some pauses/delays in some of my lua functions. Sadly there is no optimal solution as far as i searched for it on google.

    Right now i need to set specific values and change them after a specific time (milliseconds).
    These instructions are inside a normal lua table.

    I know there is a setDelay() function mentioned in the LUA docs ( http://www.visionaire-studio.com/luadocs/#commands

    But im not quite sure how i can use that inside e.g. a for-loop. Because this function doesnt really pause, it starts another function after a given time.


    Intended behaviour by me would be this (pseudo code):

    for each entry in table do

        set value a = table[i].a, b = table[i].b , c = table[i].c
        wait for table[i].pause milliseconds

    end
    1
    2
    3
    4
    5
    6


    I hope someone can help me out here and give some hints (or give a solution right away) for using this setDelay correctly.

    Thanks in advance

    Sebastian

    Thread Captain

    2331 Posts


Write post