Home / Topic / Function in line… has more than 60 up values

Function in line… has more than 60 up values

Home Kwiksher Forums Kwik 3 Bugs Function in line… has more than 60 up values

Tagged: , , , , , ,

Viewing 10 posts - 1 through 10 (of 10 total)
  • Odisej
    Participant
    #83798

    I get this error on a page with many layers, variables etc. When I remove any one action or variable it works fine. I thought there are no more limits since Kwik3? I am looking forward to your help and possible solution. Thanks!

    Yamamoto
    Keymaster
    #83799

    the limitation of the 60 up values is of lua. too many variables can not be used.

    ref
    https://forums.coronalabs.com/topic/51644-up-values/

    angel
    Participant
    #83801

    Yamamoto, have you some tutorial on how to put many variables into a table in Kwik? Thanks

    Odisej
    Participant
    #83803

    Yes, I am also struggling with tables. I guess construct a table is not that hard, interaction of variables within the table with layers, actions, buttons and the rest of Kwik tools is another matter. As fas as I understand if you construct a table all the handling should be done with external coding. So yes, I am also very much in need of a bit more in depth table handling tutorial. I know Alex has touched some of that in his Memory game and Quiz tutorials, but I find them hard to implement that logic to my case scenario. Please consider some of these more advanced features for tutorials, I would be willing to pay something to get this through official training or smth…

    Odisej
    Participant
    #83804

    BTW, I have also opened a future request for PLAY RANDOM with no repeat – meaning each action should play only once in the Play random array of actions. My question here – I think it applies to the problem we are facing with too many variables is if there is a way to remove an action from Play random actions array with external code after that action has already executed? I tried with something like this: table.remove( t )
    – my logic is that table in above code is an action name with play random actions array, t is an action I would like to remove from that list… but it doesn’t work.
    I have also tried object removeSelf or create_and_abandon() in the action after it executes but I guess I must be doing something wrong.

    Yamamoto
    Keymaster
    #83814

    Give me a little bit more time to think about making a table handling tutorial and applied it to create/remove for PLAY RANDOM with no repeat

    Odisej
    Participant
    #83822

    Well it took me a couple of nights to delve deep into lua and I finally figured some stuff. I got it to work now with tables. Random action with no repeat or remove would still be nice and save some time, although I have now created external code that shuffles the variables in the table and then removes them one by one when needed. I will open another help question since it’s not related to 60 upvalue limit.

    victortarinteclas
    Participant
    #84088

    Hi Yamamoto,
    I wanted to ask if you have in mind make the tutorial on how to put many variables (more than 60 up values) into a table in Kwik.
    As Odisej said, please consider some of these more advanced features for tutorials, I would be willing to pay something to get this through official training
    Many thanks

    Yamamoto
    Keymaster
    #84089

    when you create a variable from project and pages on kwik panel, make it as global. Kwik makes the variable as an element of table automatically.

    actions and buttons are not easy. you may need to modify codes manually.

    It could be done by using two external codes and the following work flow to change codes as along with making UI elements with Kwik simultaneously.

    1.Add external code before layers — before_ext.lua
    2.Add external code after buttons and actions — after_ext.lua
    3.Create buttons/actions etc with Kwik
    4.Publish
    5.open lua files with text editor
    6.move codes of actions and buttons ( and animations if use action is triggered at completion) to before_ext.lua and after_ext.lua
    7.replace the names of actions and buttons for the names of members of table
    8.Publish and Check
    9.go to step 3

    before_ext.lua
    ————————————–
    — declaration of buttons and actions
    ————————————–

    after_ext.lua
    —————————————
    — modification to kwik generated codes
    ————————————–

    For example, if creating two actions and two buttons, kwik generates the definitions on the top of lua file. You need to move(cut&paste) them to before_ext.lua and putting them into table.

    — Button names
    local but_217
    local but_162

    — Action names
    local act_763
    local act_832

    =>
    before_ext.lua
    ————————————–
    — declaration of buttons and actions
    composer.page_buts = {}
    composer.page_buts.but_217 = nil
    composer.page_buts.but_162 = nil

    composer.page_acts = {}
    composer.page_acts.act_763 = nil
    composer.page_acts.act_832 = nil
    ————————————–

    Next in scene:show() function you will find the generated actions and buttons like this

           -- Actions (functions) 
           act_763 = function (event) 
           end 
           act_832 = function (event) 
           end 
          --End Actions (functions) 
    
           -- Button event listeners 
           local function onShape_XEvent(event) 
              but_217(layer.Shape_X) 
              return true 
           end 
           layer.Shape_X:addEventListener("tap", onShape_XEvent ) 
    
           local function onKwiksherEvent(event) 
              but_162(layer.Kwiksher) 
              return true 
           end 
           layer.Kwiksher:addEventListener("tap", onKwiksherEvent ) 
    
           -- Button functions 
           function but_217(self) 
               act_763() 
           end 
    
           function but_162(self) 
           end 
    

    cut and paste them to after_ext.lua. Replace each name of action/button for the corresponding name of the table in before_ext.lua.

    
           -- Actions (functions) 
           composer.page_acts.act_763 = function (event) 
           end 
           composer.page_acts.act_832 = function (event) 
           end 
          --End Actions (functions) 
    
           -- Button event listeners 
           local function onShape_XEvent(event) 
              composer.page_buts.but_217(layer.Shape_X) 
              return true 
           end 
           layer.Shape_X:addEventListener("tap", onShape_XEvent ) 
    
           local function onKwiksherEvent(event) 
              composer.page_buts.but_162(layer.Kwiksher) 
              return true 
           end 
           layer.Kwiksher:addEventListener("tap", onKwiksherEvent ) 
    
           -- Button functions 
           function composer.page_buts.but_217(self) 
               composer.page_acts.act_763() 
           end 
    
           function composer.page_buts.but_162(self) 
           end 
    

    I might modify Kwik to generate codes that use tables to hold actions/buttons but it is not an easy task and need to be very carefully not to inject a bug. I won’t do it now.

    If you don’t use Kwik’s new action and add button a lot and set your own external code to the layer objects, it would save the number of UP VALUES. A example is here

    http://kwiksher.com/tutorials_kwik/ext-code-and-ext-lib-kwik-3-expert/
    http://kwiksher.com/tutorials_kwik/creating-a-memory-game/
    http://kwiksher.com/tutorials_kwik/template-use-json-with-kwik-3/

    Jorge
    Participant
    #84090

    Hi Yamamoto,
    Is the memo game code updated?
    How many cards (pairs) can I use?
    Thanks.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

Privacy Preference Center

Strictly Necessary

these coolies are for WP-SpamShield, gdpr-wp, woocommerce, paypal

PHPSESSID, SJECT16, JCS_INENREF, JCS_INENTIM, gdpr, woocommerce_cart_hash, woocommerce_items_in_cart, woocommerce_recently_viewed, wordpress_, wordpress_logged_in_, wordpress_sec_, wordpress_test_cookie, wp_woocommerce_session_, AKDC, akavpau_ppsd

Functionality

WordPress cookie created when auto-saving a post in the editor.

wp-saving-post, wp-settings-, wp-settings-time-

Performance

google analytic

__utma,__utmb,__utmc,__utmz,_ga,_gid,_gat

Advertising