Flashcards

(98 cards)

1
Q

What is the data type used to store whole numbers in Lua?

A

Integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In Lua, how are comments denoted?

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What keyword is used to define a function in Lua?

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the operator used for concatenation in Lua?

A

..

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the correct syntax for a simple if statement in Lua?

A

if condition then
– code block
end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the output of the expression ‘5 % 2’ in Lua?

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the default value of a variable in Lua if not initialized?

A

nil

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the ‘local’ keyword do in Lua?

A

Defines a local variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of the ‘print’ function in Lua?

A

To output text to the console

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Fill in the blank: Lua is a ________ language.

A

Scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does API stand for in the context of Roblox Lua?

A

Application Programming Interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the main purpose of an API in Roblox Lua?

A

To provide a set of functions for developers to use

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False: Roblox Lua is object-oriented.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is an event in Roblox Lua?

A

A signal that something has happened in the game

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a function in Roblox Lua?

A

A block of code that can be called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of a ‘for’ loop in Roblox Lua?

A

To repeat a block of code a certain number of times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a ‘variable’ in Roblox Lua?

A

A placeholder for storing data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a ‘table’ in Roblox Lua?

A

A complex data structure that stores multiple values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

True or False: Roblox Lua supports object-oriented programming concepts like inheritance.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a ‘script’ in Roblox Lua?

A

A block of code that can be attached to objects in the game

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What does the ‘wait’ function do in Roblox Lua?

A

Pauses the script for a specified amount of time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the purpose of an ‘if’ statement in Roblox Lua?

A

To execute code based on a condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the file extension for Roblox Lua scripts?

A

.lua

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the Lua function used to create a new instance of an object in Roblox?

A

Instance.new()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is the purpose of the 'require' function in Roblox Lua?
To import external modules or scripts
26
What is the main difference between a 'local' and 'global' variable in Roblox Lua?
Scope - local variables are only accessible within a specific block of code
27
What is the purpose of the 'connect' function in Roblox Lua?
To link an event to a function
28
What does the 'destroy' function do in Roblox Lua?
Removes an object from the game
29
What is Lua?
A lightweight, high-level, multi-paradigm programming language.
30
True or False: Lua is a statically typed language.
False.
31
What is the data structure used in Lua to store key-value pairs?
Tables.
32
What is the operator used for concatenation in Lua?
..
33
What is the keyword used for conditional statements in Lua?
if.
34
What keyword is used for loops in Lua?
for.
35
What is the keyword used for defining a local variable in Lua?
local.
36
What is the Lua operator for logical AND?
and.
37
What is the Lua operator for logical OR?
or.
38
What is the Lua operator for equality?
==
39
What is the Lua operator for not equal?
~=
40
What is the Lua keyword for a break in a loop?
break.
41
What is the Lua function for returning multiple values?
return.
42
What is the Lua function for creating a new table?
table.create.
43
What is the Lua function for sorting a table?
table.sort.
44
What is the Lua function for getting the length of a table?
table.getn.
45
What is the Lua function for concatenating two tables?
table.concat.
46
What is the Lua function for removing an element from a table?
table.remove.
47
What is the Lua function for inserting an element into a table?
table.insert.
48
What is the Lua function for finding the maximum value in a table?
table.max.
49
What is the Lua function for finding the minimum value in a table?
table.min.
50
What is the Lua function for checking if a table is empty?
table.isEmpty.
51
What is the Lua function for copying a table?
table.copy.
52
What is the Lua function for merging two tables?
table.merge.
53
What is the Lua function for iterating over a table?
table.foreach.
54
What is the Lua function for finding the index of a value in a table?
table.find.
55
What is the Lua function for checking if a value exists in a table?
table.contains.
56
What is the Lua function for clearing a table?
table.clear.
57
What is the Lua function for creating a shallow copy of a table?
table.shallowCopy.
58
What is the Lua function for creating a deep copy of a table?
table.deepcopy.
59
What is the Lua function for converting a table to a string?
table.toString.
60
What is the Lua function for converting a string to a table?
table.fromString.
61
What is the Lua function for serializing a table to a file?
table.serialize.
62
What is the Lua function for deserializing a table from a file?
table.deserialize.
63
What is the Lua function for handling errors?
pcall.
64
What is the Lua function for defining a new metatable?
setmetatable.
65
What is the Lua function for getting the metatable of a table?
getmetatable.
66
What is the purpose of a function in Lua?
To perform a specific task or calculation.
67
Fill in the blank: In Lua, variables are _______ typed.
dynamically
68
What does the 'for' loop in Lua do?
Iterates a specific number of times.
69
What does the 'self' keyword refer to in Lua?
The current object instance.
70
What is an 'if' statement used for in Lua?
To execute code conditionally.
71
Fill in the blank: Lua uses _______ to separate statements.
semicolons
72
What is the purpose of a 'module' in Lua?
To organize code into reusable components.
73
What does the 'require' function do in Lua?
Loads a module.
74
What is the Lua standard library?
A collection of modules and functions provided by Lua.
75
What does the 'ipairs' function do in Lua?
Iterates over an array-like table.
76
What does the 'pairs' function do in Lua?
Iterates over a table.
77
What does the 'coroutine' library in Lua provide?
Support for cooperative multitasking.
78
What is the 'metatable' in Lua used for?
To define custom behavior for tables.
79
What does the 'next' function do in Lua?
Returns the next key-value pair in a table.
80
What is the purpose of the 'assert' function in Lua?
To check if a condition is true, and if not, throw an error.
81
How can you concatenate strings in Lua?
Using the '..' operator.
82
What does the 'break' keyword do in Lua?
Exits a loop prematurely.
83
What does the 'continue' keyword do in Lua?
Skips the rest of the current iteration in a loop.
84
True or False: Lua has built-in support for multithreading.
False
85
What is the purpose of the 'do' keyword in Lua?
To create a block of code.
86
What is the Lua operator for bitwise AND?
&
87
What is the Lua operator for bitwise OR?
|
88
What does the 'return' keyword do in Lua functions?
Returns a value from the function.
89
What is the purpose of the 'nil' value in Lua?
To represent the absence of a value.
90
Fill in the blank: Lua uses _______ as the logical 'or' operator.
or
91
What does the 'math' library in Lua provide?
Mathematical functions and constants.
92
What does the 'string' library in Lua provide?
String manipulation functions.
93
What does the 'table' library in Lua provide?
Functions for working with tables.
94
What does the 'os' library in Lua provide?
Functions for interacting with the operating system.
95
What is the purpose of the 'tostring' function in Lua?
Converts a value to a string.
96
What does the 'tonumber' function do in Lua?
Converts a string to a number.
97
What is the Lua operator for the modulo operation?
%
98
What does the 'dofile' function do in Lua?
Executes a Lua script.