Announcement

Collapse
No announcement yet.

run code in the background loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • run code in the background loop

    hello,
    i'm looking for some way, to get some codes runing in the background as a loop
    i'm usining a timer but my app crush some times.
    ​​​​​so i'm looking for some other méthode to run my loop code without a crush.

  • #2
    Click image for larger version

Name:	Magician.png
Views:	165
Size:	358.0 KB
ID:	306550

    Comment


    • #3
      any code, a function for exemple.
      i want it loop in the background without crushing the app

      Comment


      • #4
        My Friend - Post your code that is crashing -- if you want someone to help
        People are not mind readers as to what you are after?

        Comment


        • #5
          you didnt understand me my friend.
          i'm not looking to fix my code, i'm looking where to put it to be a loop.
          now i'm using a timer when load my page but its not opérationnel.
          is there some other methode without using a timer ?

          Comment


          • #6
            Hello
            In general, we have several types of loops:
            1- for
            2- while
            3- repeat .. until

            1-

            for variable = start,end,step do
            The desired commands
            end

            An example command:

            for i = 0,10,2 do
            dialog.message(i);
            end

            Command result:

            2,4,6,8,10

            In this loop, when the i reaches 10, the loop stops and no longer runs

            2-

            variable1 = 0
            while (variable1 = 10) do
            The desired commands
            variable1 = variable1+1
            end

            The for difference with while is in the condition, ie it is checked first. If the condition is correct, the command is executed, but otherwise it is not.

            3-

            variable1 = 0
            repeat
            The desired commands
            variable1 = variable1+1
            until variable1 == 10;

            The difference between repeat and while is a condition at the time of review, ie repeat is reviewed at the end and while at the beginning.

            good luck..

            Comment


            • #7
              some tips
              first: it is not recommended to put loops in timers unless you are very carefull
              second: avoid putting sleep action in timers
              specially sleeps with period larger then the timer interval (that grantee crash)
              at last
              lua is not a multi thread language

              Comment

              Working...
              X