How can i create a randomized question poll for a game?

Hello, I’m developing a game where the user has to answer to some questions. The game has multiple levels and each level takes his questions from its poll. The questions are random. How can I create something like this? I don’t need the code, I’d just like to know if there is any widget or procedure to follow to do this.
Thanks in advance :slight_smile:

Hi @DarkVader75,

Use math.random

  • math.random() with no arguments generates a real number between 0 and 1.
  • math.random(upper) generates integer numbers between 1 and upper (both inclusive).
  • math.random(lower, upper) generates integer numbers between lower and upper (both inclusive).

Have a nice day:)
ldurniat

I’m not 100% what you’re asking for, but I have a template that allows you to create multiple-choice quizzes.


There is no such thing as a quiz widget however. If you don’t use a template, this is will be DIY effort requiring knowledge of:

  • Lua table basics, ranodomization, etc.
  • Solar2D/Corona basics: Project creation, screen setup and scaling, building for iOS/Android, ++
  • Scene management
  • ++

Download Entire RG_Free_Stuff Repository: https://github.com/roaminggamer/RG_FreeStuff

Browse Products: https://github.com/roaminggamer/RG_FreeStuff/tree/master/Products

All my free templates (old post):

The Quiz Template (2 in one) info page: https://github.com/roaminggamer/RG_FreeStuff/tree/master/Products/Basic%20Quiz
Direct download zip: https://github.com/roaminggamer/RG_FreeStuff/raw/master/Products/Basic%20Quiz/BasicQuiz_180503.zip

I can’t use templates since this is a school project.
Can You give me more details about the other option? What exactly is ++? I know lua table basics, randomization and scene management.

By ++ I meant ‘and more’. i.e you’ll have to learn a number of things, but I didn’t want to list them all because it would be time consuming and not entirely helpful to list them.

You’ll learn many of the things that would have been under ++ when you come up against a question. e.g. How do I do X, where X is a specific thing.