Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
A more concise way to type this snippet? — Gideros Forum

A more concise way to type this snippet?

NinjadoodleNinjadoodle Member
edited February 2016 in General questions
Hi guys

Could anyone please show me a more concise way to type this up - perhaps using a for loop?
self.dial1 = MovieClip.new{
{1, 1, frames[1]}, 
{2, 2, frames[2]},
{3, 3, frames[3]},
{4, 4, frames[4]},
{5, 5, frames[5]},
{6, 6, frames[6]},
{7, 7, frames[7]},
{8, 8, frames[8]},
{9, 9, frames[9]},
{10, 10, frames[10]},
{11, 11, frames[11]},
{12, 12, frames[12]},
{13, 13, frames[13]},
{14, 14, frames[14]},
{15, 15, frames[15]},
}
Thank you heaps in advance!

Comments

  • antixantix Member
    edited February 2016 Accepted Answer
    local function genClip(frames, count)
      local clip = {}
      for i = 1, count do
        table.insert(clip,{i, i, frames[i]})
      end
      return MovieClip.new(clip)
    end
     
    self.dial1 = genClip(frames, 15)
    Would something like that work?

    Likes: mertocan, Apollo14

    +1 -1 (+2 / -0 )Share on Facebook
  • Hi @antix

    Thanks heaps!

    That's really useful and exactly what I was looking for :)

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • No worries, I didn't test it but it seems it worked for you ~:>
Sign In or Register to comment.