Тёмный
No video :(

Explaining Lua Tables as if You Were 5 

ByteBlox
Подписаться 69 тыс.
Просмотров 9 тыс.
50% 1

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@byteblox100
@byteblox100 8 месяцев назад
Get all of my knowledge in one package:
linktr.ee/ByteBlox
@randomhuman69420
@randomhuman69420 8 месяцев назад
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 8 месяцев назад
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 8 месяцев назад
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 8 месяцев назад
​@@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 8 месяцев назад
@@someonerandom9939 ah that explanation is clearer than what I read online, thanks
@ballsack7692
@ballsack7692 8 месяцев назад
being able to implement instances as dictionary keys has improved optimization a TON for my games.
@CapedBojji
@CapedBojji 8 месяцев назад
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 8 месяцев назад
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 !
@Eggvelop
@Eggvelop 8 месяцев назад
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 8 месяцев назад
yeah thats what i wanted to point out too
@ScriptedExpert
@ScriptedExpert 8 месяцев назад
I saw that too
@samuelpc180
@samuelpc180 8 месяцев назад
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 8 месяцев назад
He forgot to remove the line tableName.functionName, which he could have used the index it would work, but the functionName does not exist.
@Tkdriverx
@Tkdriverx 8 месяцев назад
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]()`
@noturne54
@noturne54 8 месяцев назад
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.
@Creeper_945
@Creeper_945 8 месяцев назад
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 8 месяцев назад
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 8 месяцев назад
well, this is understandable, a table is the only data structure in Lua.
@gamewithog
@gamewithog 8 месяцев назад
In a game, what will a table be used for?
@Zawaito
@Zawaito 8 месяцев назад
As it seems tables print in alphabetic order by default
@Martanus
@Martanus 8 месяцев назад
PLEASE make a video about metatables, I don't understand them and I learn extremely efficiently from your videos!
@andreyromashchenko8967
@andreyromashchenko8967 Месяц назад
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.
@stephen5070
@stephen5070 Месяц назад
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?
@hlflifeenjoyer6176
@hlflifeenjoyer6176 8 месяцев назад
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
@GetUrFunnyUp
@GetUrFunnyUp 8 месяцев назад
What is this video my bro? How are tables complicated? They are an array and a dictonary
@wonsole
@wonsole 8 месяцев назад
Can u teach us about " Strings. " ?
@multistronomy
@multistronomy 8 месяцев назад
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 8 месяцев назад
How have you coded for years without knowing tables?
@multistronomy
@multistronomy 8 месяцев назад
@@JoaoMPdS tbh idk, never needed it
@JoaoMPdS
@JoaoMPdS 8 месяцев назад
@@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 8 месяцев назад
@@JoaoMPdS whoopsies
@Tactician00
@Tactician00 8 месяцев назад
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
@Sadjhj
@Sadjhj 8 месяцев назад
I like tables
@A.Theory
@A.Theory Месяц назад
So underated W mans
@thefishdevelopment1035
@thefishdevelopment1035 8 месяцев назад
You should fully read the errors you get, lol. But very good content tho
@kirillchshukin6602
@kirillchshukin6602 8 месяцев назад
Hey thank you for helping us cloud you Explain the Buffer libary in roblox and mybye the Module yk
@LeapInno
@LeapInno 8 месяцев назад
Thanks. Tables didn't make a lot of sense to me.
@wonsole
@wonsole 8 месяцев назад
it gave me an error at the first part. it gave me " table: 0x94a50b1edb0dc5cc "
@G_odiek
@G_odiek 5 месяцев назад
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???
@howatcher
@howatcher 8 месяцев назад
this is why i am the tables
@oof2568
@oof2568 8 месяцев назад
I am not In Pairs Script, I AM THE TABLES. I AM THE ONE WHO REQUIRE()
@kaiji2542
@kaiji2542 5 месяцев назад
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 5 месяцев назад
GetPlayers is already a table. You don’t have to make another table, you can just do pla[1]
@kingswag7
@kingswag7 8 месяцев назад
Tables make sense but what about.. table flip?
@HeyShattered
@HeyShattered 5 месяцев назад
Viewers who *ARE* 5 and are watching this video: am i a joke to you?
@imbadwithnamestoo
@imbadwithnamestoo 5 месяцев назад
do you have a discord for people who need help with scripting?
@byteblox100
@byteblox100 5 месяцев назад
discord.gg/byteblox
@byteblox100
@byteblox100 5 месяцев назад
Wait the link expired lol, just check the descriptions of recent videos
@emotionallydeprived1889
@emotionallydeprived1889 8 месяцев назад
OH PLEASE DO METATABLES!!!
@byteblox100
@byteblox100 8 месяцев назад
Nah bro that’s like some matrix stuff
@emotionallydeprived1889
@emotionallydeprived1889 8 месяцев назад
@@byteblox100 PLEASE!!! I NEED TO KNOW ABOUT THEM 😭😭😭
@lightdragon8182
@lightdragon8182 8 месяцев назад
​​​​@@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
@arisethee
@arisethee 8 месяцев назад
key? not index?
@byteblox100
@byteblox100 8 месяцев назад
Both work
@dayjobman9031
@dayjobman9031 8 месяцев назад
tables are simple
@weridtem
@weridtem 8 месяцев назад
Its arrays
@gooberpiebuba
@gooberpiebuba 5 месяцев назад
I'm 4 so I can't understand 💀💀💀💀💀
@bbnmm8720
@bbnmm8720 8 месяцев назад
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 8 месяцев назад
tables suck on roblox
@ProtogenArt
@ProtogenArt 6 месяцев назад
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
Просмотров 11 тыс.
Why Video Game Achievements Got Worse
20:08
Просмотров 11 тыс.
3d printed demon core vs real
00:24
Просмотров 7 млн
Programming Rarity is Harder Than You Think
12:31
Просмотров 260 тыс.
The Obscure Lore Of Larva
30:33
Просмотров 945 тыс.
METATABLES | What are they and how can we use them?
18:40
Electromagnetic Aircraft Launcher
15:09
Просмотров 698 тыс.
Explaining ModuleScripts As If You Were 5
9:01
Просмотров 56 тыс.
Can You Beat FNaF World With Instakills ONLY?
23:21
you SUCK at organizing scripts... Let's fix that!
13:12
What is Object Oriented Progamming?
13:27
Просмотров 39 тыс.
I Spent 24 HOURS Learning Scripting In Roblox
15:50
Просмотров 13 тыс.
You Should Make Roblox Knockoffs NOW
28:49
Просмотров 16 тыс.