Explaining 'Self' - Lua Tutorial (2021)

preview_player
Показать описание
What is "Self" in Lua, which is often used when doing OOP (Object oriented programming)? While it looks like a keyword it's just syntax sugar, but what does that mean?
Find out in 4 minutes!

Socials:

Рекомендации по теме
Комментарии
Автор

Keep up the good work, pal. There are not enough people who make videos on lua and love2d.

trungodword
Автор

Some people should be grateful this guy is here on YouTube

rizenos
Автор

thank you!! that was really clarifying, Ive been always kinda geeky but never thought of coding myself until I needed to learn lua so I can script for a software I use at my line of work, thanks to people like you with these amazing videos I'm finding myself really drown by this ''programming world'' and though its little hard(I just started) I think i will manage in time if I keep watching yours and other lua tutorials on youtube, again, THAN YOU I really appreciate your work! SUBSCRIBED!

tomaseguchi
Автор

Thanks for explanation! It all starts to slowly make sense when considering that everything is a dictionary. A little technical note: the video is a little bit unsharp even on 1080p which is particularly important when looking at colored text on black background.

hommhommhomm
Автор

Really great Lua content. Not much out there of this topic, so this is really great! Maybe a bigger font on your editor will be better. Keep going!

nicolasiriarte
Автор

So very helpful
i hope you continue with these videos

fennfo
Автор

YT notification say - lua
i hear - Dev jeeper
(first comment and like)
(next vid idea: andoid game in love 2d)

redtree-freecopyrightmusic
Автор

I loved the video! In the next videos, instead of zooming all the time, you could increase the font in the text editor.

joaopauloalbq
Автор

Description: What is syntactic sugar?
Me: Sugar Crash?

changedev.
Автор

I actually waited for the day that you can no longer say "I read all of your comments." because of the sheer number of subs-commenters.

thesphyrth
Автор

cette video a dissipé toutes les zones d ombres que j avais sur self

jeremymbabi
Автор

I am a Bigginer Scripter and my question is; when and where and why to use and how i can say i really needed that

NoName-ujth
Автор

And what does this weirdness do?

function someTable:someFunction()
local o = {}
setmetatable(o, self)
self.__index = self

...
end

erykczajkowski
Автор

Woooow now I was able to get why my previous attempts didn't work. I got stuck trying multiple combinations of ':' and '.' while using table and functions hehe. I'm pretty sure that I'll still make a few mistakes here and there until I'm used to it, but the lesson was amazing.

I have a small question tho. Let's say that we have "Creature = {}" and then we add functions to it (Creature:move(), Creature:attack() and so on). Then we code some creatures like Player = {x = 0, y = 0}, MonsterA = {x = 1, y = 1) etc.

If I really got it, I can use Creature functions on all these, right? (Creature.move(Player) would work but Creature:move(Player) wouldn't). If that's correct, is this the "right" way to do this? It feels like I'm missing something here.

While watching your Pong videos I was "wow'ed" multiple times by how clean your code is and how everything interacts with everything. I, at this point, can code some simple stuff, but when it comes to making all of them interact (like the example above) I get really lost and everything starts to break.

alexandreferraz
Автор

I am a scratcher... so my mind works for entities and events and stuff to work in parallel... i like Lua but my mind doesnt work sequentially... i know i can build multi tasking (and i will).... but is there anyway to build new keywords for Lua using the language itself? (Like new keywords... not function calling)

Scudmaster
Автор

It would help if I could actually read the code !! We havent all got 20:20 vision !!

geoffw.
Автор

Can you send additional arguments to functions within "classes"?

jafsterlordbib
Автор

In my recent thing I’ve been using the : to envoke the functions I want but also giving those functions self as the first arg... now wondering if removing that would be fine or not

smellyfishstiks
Автор

The beginning of the video: "let's talk about keyword self"

self is __not__ a keyword.

UPD: oops watched the rest of the video :)

bogdansikach
join shbcf.ru