Different Data Types

Learn about different data types for variables and what they do.

by Daniel_Earl4

Author Avatar


Hello so in this tutorial im going to show you the different data types for variables.

There are many different types of data types in lua which are used to store many different things like a players money count, checking if a condition is met and the list goes on. The following is a list showing all data types, an example, a description, and why we use them.

#String String represents text, such as words or sentences, including letters, numbers and punctuation. String values are surounded by quotation marks.


"Hello, world!"

"Good morning"

"I am a roblox coder!"

Common uses in roblox: To make characters talk.


Numbers represent numerical values, which can be used to hold counts, preform mathematial equations, and represent unites of measure.





Common uses in roblox: Hitpoints, amounts of money, timers.


Table represents pairs of items. The first item is called the "index" or "key." The second item in a pair is called its "value." In the example below, the keys are types of fruit, and the values are their colors. Tables are declared with bracket, like these: {}.


{apple = "red",
banana = "yellow",
pear = "green"}

Common uses in roblox: A complex object, like a vehicle, or a list of items and their properties.


Userdata is a pointer, or reference to an object. The Userdate doesnt contain information itself, but it points to an object.



Common uses in roblox: Working with special objects, like the Workspace.


A single value of 1 or 0. True or false. Used in logic.




Common uses in roblox: Whether or not a player has defeated a boss.

#Nil A special type of value that indicates that no value has been assigned.



Common uses in roblox: Creating variables in advance, before you know what they will contain.


A function is a set of instructions that have been grouped together and givin a name. Instead of writing the same instructions multiple times, you can group them into a function, then "call" the function to execute those instructions whenever you want. There is a special kind of function called a "method." Methods perform an action on a variable.


function hamburger()
   print("I am a food")

Common uses on roblox: Printing things, defining how an object behaves.

So thats all the types of data in lua i hope this helped and cleared up some things anyway have an amazing day bye!

View in-game to comment, award, and more!