Skip to content

Instantly share code, notes, and snippets.

@rozer007
Created December 2, 2021 10:59
Show Gist options
  • Save rozer007/48795285689255a3da4fa2b3b3af77fa to your computer and use it in GitHub Desktop.
Save rozer007/48795285689255a3da4fa2b3b3af77fa to your computer and use it in GitHub Desktop.
Basics in lua
Q1.How can we accept a integer value from a user ?
ans : we use tonumber() function to convert the string input from the user to numbers.
Q2.what is the synax for multiline comment in lua?
ans: --[[ comments --]]
Q3.What will be the default value when we create any variable?
ans: nil
Q4.How can we check the type of a variable in lua?
ans: we use type() function.
Q1.What will be the output of this statement :
num=12.333
print(type(num))
a) decimal
b) float
c) number
d) none of the above
and: c)
Q2.What will be the output of the statememt :
print(num)
a) error
b) undefined
c) nil
d) none of the above
and: c)
Q3.which one is not a datatype in lus ?
a) decimal
b) number
c) float
d) both c and a
ans: d)
Q4) what will the output of this code:
a="12"
b=12
print(a+b)
a) 24
b) 1212
c) error
d) none of the above
ans: a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment