Explaining Lua Tables as if You Were 5

  Рет қаралды 10,630

ByteBlox

ByteBlox

Күн бұрын

Пікірлер: 66
@byteblox100
@byteblox100 11 ай бұрын
Get all of my knowledge in one package:
linktr.ee/ByteBlox
@randomhuman69420
@randomhuman69420 11 ай бұрын
The reason why it gave you the "Attempt to call a nil value" error was because you did tableName.functionName() later, not because of the type of key.
@HorFoxPlanet
@HorFoxPlanet 11 ай бұрын
No they don't. They work the same as other programming languages, the key difference is that Luau is not restrictive with it's variable types or table/array structure by default. You can fix this by setting the script to scrict mode or by limiting or defining table structuring. The other problem which people might think is an issue is the apparent loss of ordering. This is not an engine problem, it has to do with time of execution. This can be fixed by using indexes. This tutorial was poorly planned and has mistakes, so they look a lot harder than they actually are. It's ok to do things on the go but please, prepare beforehand to avoid misinterpretations because people watching these videos usually have little to no experience with programming.
@haxking2352
@haxking2352 11 ай бұрын
Just looked at what strict mode was because I didn’t know, but I’m still a tiny bit uncertain of it’s uses. Is it just used when making classes and functions so you know what type each value/param should be every time? Or are there more uses of it?
@someonerandom9939
@someonerandom9939 11 ай бұрын
​@@haxking2352it makes the typing strict like in other languages like C, so you can't make a variable with type number and then assign a string to it or something like that
@haxking2352
@haxking2352 11 ай бұрын
@@someonerandom9939 ah that explanation is clearer than what I read online, thanks
@ballsack7692
@ballsack7692 11 ай бұрын
being able to implement instances as dictionary keys has improved optimization a TON for my games.
@CapedBojji
@CapedBojji 10 ай бұрын
Not separating tables and maps is stupid. Not having an inbuilt. Length for maps is stupid. Meta tables are really dumb considering it doesn't trigger on assignment which, I guess that js meant for speed but it still could have been implemented
@sweet-corn
@sweet-corn 11 ай бұрын
idk if anyone's said this but i personally reaaally like your thumbnails, especially how they have a dotted frame around it gives them a nice touch, they look cool !
@Tkdriverx
@Tkdriverx 11 ай бұрын
10:00 You were calling a function by the name of functionName when you changed the key to 1. You would have needed to do `tableName[1]()`
@Creeper_945
@Creeper_945 11 ай бұрын
4:29 its because the table names were written in alphabetical order, and three comes before two in that order since the "h" in "three" comes before the "w" in "two", hence why it looked like that!
@Tkdriverx
@Tkdriverx 11 ай бұрын
Its not just Roblox though. Lua is just super open what you can do with arrays/dictionaries. Also just quick information for those confused about names: "Table" is just a higher order data type that arrays and dictionaries are based off. Arrays are "tables" that have numerical indices (usually implied, as in the first example). Dictionaries are "tables" that have strings as indices. You can also mix and match between index types, you can have some numbers, strings, etc.. However in Lua, you can place whatever you want as a key. Objects, other tables, functions, booleans, etc.. I believe these would be a form of dictionary.
@execute214
@execute214 11 ай бұрын
well, this is understandable, a table is the only data structure in Lua.
@Martanus
@Martanus 11 ай бұрын
PLEASE make a video about metatables, I don't understand them and I learn extremely efficiently from your videos!
@samuelpc180
@samuelpc180 11 ай бұрын
Functions with a key that is a number can be run. I like your teaching style, but at least teach things that is correct.
@40P3
@40P3 11 ай бұрын
He forgot to remove the line tableName.functionName, which he could have used the index it would work, but the functionName does not exist.
@Eggvelop
@Eggvelop 11 ай бұрын
i would like to bring up a problem, it will certainly print out the function with a index of 1, but you called the tableName.functionName() which doesnt exist anymore at 9:50
@bulletbot1486
@bulletbot1486 11 ай бұрын
yeah thats what i wanted to point out too
@ScriptedExpert
@ScriptedExpert 11 ай бұрын
I saw that too
@Zawaito
@Zawaito 11 ай бұрын
As it seems tables print in alphabetic order by default
@noturne54
@noturne54 11 ай бұрын
I really don't get the point of this video. They are not unecessarily complicated, they are only extremely flexible, and I find myself using this flexibility all the time.
@xxxxxx-n1y
@xxxxxx-n1y Ай бұрын
for the people tryna learn tables duh
@gamewithog
@gamewithog 11 ай бұрын
In a game, what will a table be used for?
@multistronomy
@multistronomy 11 ай бұрын
i really like watching your tutorials, i've always wondered how to do tables. it was the only thing i didn't know how to use for years. recently i discovered you and i wanted to ask if you could make a tutorial on tables but you already did it! thank you.
@JoaoMPdS
@JoaoMPdS 11 ай бұрын
How have you coded for years without knowing tables?
@multistronomy
@multistronomy 11 ай бұрын
@@JoaoMPdS tbh idk, never needed it
@JoaoMPdS
@JoaoMPdS 11 ай бұрын
@@multistronomy I don't know any script where I didn't use them. U use them on module scripts, on for loops. Crazy
@multistronomy
@multistronomy 11 ай бұрын
@@JoaoMPdS whoopsies
@kirillchshukin6602
@kirillchshukin6602 11 ай бұрын
Hey thank you for helping us cloud you Explain the Buffer libary in roblox and mybye the Module yk
@hlflifeenjoyer6176
@hlflifeenjoyer6176 11 ай бұрын
I actually use metatables in almost all my projects a video about it would be awesome but unfortunately you're too tired so maybe later or never
@HeyShattered
@HeyShattered 7 ай бұрын
Viewers who *ARE* 5 and are watching this video: am i a joke to you?
@Tactician00
@Tactician00 11 ай бұрын
The reason it doesnt work at around 9:45 is because you are running a function FunctionName which does not exist as the string was changed to a number, imagine forgetting to change it I assume tableName[1] would work, but i really am not sure
@LeapInno
@LeapInno 11 ай бұрын
Thanks. Tables didn't make a lot of sense to me.
@wonsole
@wonsole 10 ай бұрын
Can u teach us about " Strings. " ?
@thefishdevelopment1035
@thefishdevelopment1035 11 ай бұрын
You should fully read the errors you get, lol. But very good content tho
@andreyromashchenko8967
@andreyromashchenko8967 4 ай бұрын
12:17 why though? Will that make an apple turn red? What would you achieve by writing that? …. I want to see how things you write can be applied to the game.
@x_gwb
@x_gwb 11 ай бұрын
Tables make sense but what about.. table flip?
@Sadjhj
@Sadjhj 11 ай бұрын
I like tables
@stephen5070
@stephen5070 4 ай бұрын
How do you manage tables on a big Roblox Studio project? I want to know if it's possible to use dot notation for automatically created tables within a Module Script. Those tables are only filled up during run time, so what are my options here ByteBlox?
@A.Theory
@A.Theory 4 ай бұрын
So underated W mans
@GetUrFunnyUp
@GetUrFunnyUp 11 ай бұрын
What is this video my bro? How are tables complicated? They are an array and a dictonary
@howatcher
@howatcher 11 ай бұрын
this is why i am the tables
@oof2568
@oof2568 11 ай бұрын
I am not In Pairs Script, I AM THE TABLES. I AM THE ONE WHO REQUIRE()
@TheCrazySuperWeasel
@TheCrazySuperWeasel 2 ай бұрын
How do I change the key of an already created Value?
@emotionallydeprived1889
@emotionallydeprived1889 11 ай бұрын
OH PLEASE DO METATABLES!!!
@byteblox100
@byteblox100 11 ай бұрын
Nah bro that’s like some matrix stuff
@emotionallydeprived1889
@emotionallydeprived1889 11 ай бұрын
@@byteblox100 PLEASE!!! I NEED TO KNOW ABOUT THEM 😭😭😭
@lightdragon8182
@lightdragon8182 10 ай бұрын
​​​​@@emotionallydeprived1889Metatables are used for OOP and warning something does not exist to the player via probably UI (You don't know what exactly will contain in a table) or to make them fancy. That's it. So you should only understand the __index and __newindex metamethods. The rest is BS
@wonsole
@wonsole 10 ай бұрын
it gave me an error at the first part. it gave me " table: 0x94a50b1edb0dc5cc "
@G_odiek
@G_odiek 8 ай бұрын
I'm having the same problem, I tried to solve it multiple times, but my table still won't print, btw, if you solved the problem how did u do it???
@kaiji2542
@kaiji2542 7 ай бұрын
Im trying to make a table with the players in the server and wanted it to print the first player that is listed, here is the script, pls tell me for corrections: local pla = game.Players:GetPlayers() local tab = { pla } print(tab[1])
@byteblox100
@byteblox100 7 ай бұрын
GetPlayers is already a table. You don’t have to make another table, you can just do pla[1]
@imbadwithnamestoo
@imbadwithnamestoo 8 ай бұрын
do you have a discord for people who need help with scripting?
@byteblox100
@byteblox100 8 ай бұрын
discord.gg/byteblox
@byteblox100
@byteblox100 8 ай бұрын
Wait the link expired lol, just check the descriptions of recent videos
@dayjobman9031
@dayjobman9031 10 ай бұрын
tables are simple
@weridtem
@weridtem 11 ай бұрын
Its arrays
@negerleins
@negerleins 11 ай бұрын
key? not index?
@byteblox100
@byteblox100 11 ай бұрын
Both work
@gooberpiebuba
@gooberpiebuba 8 ай бұрын
I'm 4 so I can't understand 💀💀💀💀💀
@bbnmm8720
@bbnmm8720 11 ай бұрын
buddy stop doing bad tutorials you're not born to teach this is an poor table tutorial, almost all ur tuts are bad you need to have responsability you're teaching new people how to be bad programmers
@MasSensei
@MasSensei 11 ай бұрын
tables suck on roblox
@ProtogenArt
@ProtogenArt 9 ай бұрын
When you printed out the first value, print(tableName[1]), that told me exactly how to make a dialogue script for my shopkeeper!, heres the script i made, as i already have SOME experience with scripting. local hum = script.Parent:WaitForChild("Humanoid") local anim = Instance.new("Animation") local anim2 = Instance.new("Animation") local anim3 = Instance.new("Animation") local tableVar = {"hi!", "hello.", "hey! :3", "hi there. >:3", "i uh. broke the icecream machine again!!.. sowwy 3:", "hawoo!!! :3", "hihihihi welcome to me shop!!!! :3", "super funny text that you WONT see!!... or you will, idk! :3", "awh man... me icecream spill on ground... wutever!! i get other one!! >:3", "what would u like???? :3!!", "hai there!!!", "haaiii there!!! :3"} local messages = #tableVar anim.AnimationId = "rbxassetid://16393685271" anim2.AnimationId = "rbxassetid://16394153075" anim3.AnimationId = "rbxassetid://16394762243" local playanim = hum:LoadAnimation(anim) local playanim2 = hum:LoadAnimation(anim2) local playanim3 = hum:LoadAnimation(anim3) local numbertick = math.random(1, 10) local oldnumber wait(numbertick, print(numbertick)) playanim:Play() script.Parent.Head.Shout.Message.Text = tableVar[math.random(1, #tableVar or messages)] warn(script.Parent.Head.Shout.Message.Text) while script.Enabled == true do local funnynumber = math.random(1, #tableVar or messages) oldnumber = funnynumber wait(math.random(playanim.Length + 2, playanim.Length + 5)) playanim:Play() script.Parent.Head.Shout.Message.Text = tableVar[funnynumber] print(funnynumber or oldnumber) warn(script.Parent.Head.Shout.Message.Text) end. Thanks for all of the small tips! They still help!
What Does "Disconnect" Really Do?
7:31
ByteBlox
Рет қаралды 12 М.
The Minecraft Movie memes are way too good.
8:10
Phoenix SC
Рет қаралды 766 М.
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 22 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
Roblox Loops Explained As If You Were 5
12:38
ByteBlox
Рет қаралды 15 М.
METATABLES | What are they and how can we use them?
18:40
Crusherfire
Рет қаралды 25 М.
Why You Should Use CFrames
9:32
ByteBlox
Рет қаралды 23 М.
Explaining ModuleScripts As If You Were 5
9:01
ByteBlox
Рет қаралды 63 М.
I Learned How to SCRIPT in 7 Days | Roblox
11:00
Simjet
Рет қаралды 129 М.
How to STUDY so FAST it feels like CHEATING
8:03
The Angry Explainer
Рет қаралды 1,8 МЛН
How Roblox Went Down For 73 Hours
16:24
Kevin Fang
Рет қаралды 292 М.
Classic Roblox Games: How Are They Doing?
17:09
Chappy
Рет қаралды 427 М.
How pro Roblox developers learnt to script
10:03
AlvinBlox
Рет қаралды 864 М.