Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to pass Scen manager Limits for a lot of scenes — Gideros Forum

How to pass Scen manager Limits for a lot of scenes

omeromer Member
edited January 2013 in Code snippets
Hi,
I am preparing a module, It includes a lot of sub scenes.
Classic method for definition of scenes.

local pages = {"Al4page1","Al4page2","Al4page3","Al4page4","Al4page5","Al4page6"}

scen["Al4page1"] =Al4page1
scen["Al4page2"] =Al4page2
.... etc.
That's boring, you must define each scene using scen["Al4page1"] =Al4page1 format.
My question is simple. Can you suggest an alternative solution to define scens like pages table format instead of scen["Al4page1"] =Al4page1 format?
Is it possible to declare using an while or repat programmatic logic?

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited January 2013
    Well not tested but I think something like that should work:
    for i = 1, #pages do
        scen[pages[i]] = _G[pages[i]]
    end
    _G is the object that holds global scope, so each global object is a property of _G
Sign In or Register to comment.