Co-Routines - Lua Tutorial (Part 11)

  Рет қаралды 7,765

Steve's teacher

Steve's teacher

Күн бұрын

Пікірлер
@BaconEggUSA
@BaconEggUSA Жыл бұрын
Hello. How can I calculate the number of DAYS between two dates? ie. Difference between 03-15-2023 and 01-01-2023. = 73 days. Thanks!
@RRKS_TF
@RRKS_TF Жыл бұрын
Extract the number for each value of a date, then compute the difference between the same units before finally converting each unit into days and summing them up. Accounting for leap years can be accounted for by using a non-exact factor for how many days in a year, then flooring the result
@downey2294
@downey2294 Жыл бұрын
thank you for the video. so if i understand it correctly there is only one running coroutine at a given time? also are there any other ways for multi threading?
@Stevesteacher
@Stevesteacher Жыл бұрын
Yes, if one co-routine has to wait for a task, another will run instead, switching between them for more efficient code execution I don't think Lua natively supports other ways for multi threading, however, if you learn C or C++, you should be able to implement it and then just run Lua files in threads... I've also heard LuaJIT includes FFI, which allows you to interface with C, which in return could allow you to do multi threaded tasks
@_GreenShadow_
@_GreenShadow_ 2 жыл бұрын
What programming client are you using?
@downey2294
@downey2294 Жыл бұрын
says in the top, its vs code. what you are referring to as an "programming client" is called an IDE its short for integrated development environment.
@leavesfed5462
@leavesfed5462 2 жыл бұрын
Hey I wanted to ask you something: Local function loop() Print(“what number do you want to start on”) Input = io.read() Print(“your number: “ .. input) For i = input, 10 do Print(i) End End Now this works perfectly fine but when I store the function as a variable Local test = loop() Print(test) It prints out all the numbers from input to ten but at the end it gives me nil for some reason.
@Stevesteacher
@Stevesteacher 2 жыл бұрын
That is because the function returns nil, at the end of the function, after the loop and before the final end, put "return 0", then you'll get 0 instead of nil
@leavesfed5462
@leavesfed5462 2 жыл бұрын
@@Stevesteacher oh I understand now thank you, so it’s better off not using a function for a simple loop like this
@leavesfed5462
@leavesfed5462 2 жыл бұрын
@@Stevesteacher but wait, that didn’t happen on the first try, only after I put it in a variable
@orangegamer
@orangegamer Жыл бұрын
@@leavesfed5462that’s what, when ur simply it running it, it’s just printing those values, however when you are storing the function in a variable the value of return is being Handed over to it, hence when you u print it’ll print null
@AdrianTRYaValioCheetos
@AdrianTRYaValioCheetos 3 жыл бұрын
Very nice!!! :D
@damnedattendant2536
@damnedattendant2536 4 ай бұрын
I just saw fairytail and I knew .. this is my bro ..
@tooeooeenee4855
@tooeooeenee4855 3 жыл бұрын
Cool! 👌👌👌👌👌👌👌👌👌
@Im_Ninooo
@Im_Ninooo 2 жыл бұрын
I'm a Go dev and goroutines + channels make so much more sense for me hahah
@ктоя-и7ъ
@ктоя-и7ъ 3 ай бұрын
сложно
Working with Files - Lua Tutorial (Part 12)
12:32
Steve's teacher
Рет қаралды 6 М.
The Essence of Coroutines
8:10
Dave Leeds
Рет қаралды 13 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Roblox Creates React In Lua
10:10
ThePrimeTime
Рет қаралды 92 М.
Coroutines in Unity (how & when to use them)
12:35
Game Dev Beginner
Рет қаралды 32 М.
OOP (Object Oriented Programming) - Lua tutorial (Part 15)
24:03
Steve's teacher
Рет қаралды 9 М.
Every Framework Sucks Now
24:11
Theo - t3․gg
Рет қаралды 143 М.
Lua Crash Course - Less than 15mins
14:50
PohkaDev
Рет қаралды 124 М.
Automating Sequences via Lua Coroutines in C++
45:23
javidx9
Рет қаралды 60 М.
Why Is Lua So Popular?
8:03
Awesome
Рет қаралды 102 М.
x86 Assembly: Hello World!
14:33
John Hammond
Рет қаралды 1,4 МЛН
Functions - Lua Basics (Part 10)
9:16
Steve's teacher
Рет қаралды 6 М.
I Designed My Own 16-bit CPU
15:46
AstroSam
Рет қаралды 2,1 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН