GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

table search function inside of a random function

hi there. i am trying to streamline my code and was wondering if anyone have tried using a table search function inside of a random function?

Comments

  • tatiangtatiang Posts: 11,493Member, Sous Chef, PRO, Senior Sous-Chef

    It should work as long as it's a small table. I would imagine the random function parameters would be evaluated extremely quickly but perhaps adding a tableSearch function inside would cause it to pause for evaluation? I'm doubtful so you'll just have to try it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Posts: 11,493Member, Sous Chef, PRO, Senior Sous-Chef

    Honestly, it's better to just separate out the evaluations:

    Change attribute game.foundRow to tableSearch(blah blah blah)
    Change attribute game.randomResult to random(1,game.foundRow)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.