Embedding Lua in C++ #1

  Рет қаралды 177,680

javidx9

javidx9

Күн бұрын

Пікірлер: 378
@GTR487
@GTR487 2 жыл бұрын
I watched this video 2y ago but I was unable to understand it because I didn't know English. Two years later, after learning English, I'm able to fully understand the video, and that's great, because it's an amazing explication. Thanks you very much :)
@Hersatz
@Hersatz 5 ай бұрын
2 years to get this level of fluency. Good for you, mate!
@robinvanderploeg5485
@robinvanderploeg5485 5 жыл бұрын
"I'm using tabs for spacing instead of multiple spaces. This will make people angry. Additionally, I am going to place opening brackets on a new line instead of at the end of the preceding line. This will also make people very angry. Actually, every single thing I do here will make people angry, because people are horrible and this is why we can not have nice things."
@Nunya58294
@Nunya58294 9 ай бұрын
People that do shit like that are stupid
@bigcrazycarboy672
@bigcrazycarboy672 3 жыл бұрын
This has got to be the best tutorial on KZbin for this. It's extremely well made and rich with content. I hope to eventually get the opportunity to embed Lua in a game in Unreal Engine, but this is the first step ;)
@BlazertronGames
@BlazertronGames 2 жыл бұрын
Best tutorial for this on the internet, let alone youtube. I spent hours trying to figure out how to embed lua in c++, and all that came up were bad tutorials that barely mention anything. Even the official documentation doesn't cover it very well. This video covers lots and explains it really well in 35 minutes. Although, I do wish there was a text version of this video, for quick reference.
@Ruxify
@Ruxify 5 жыл бұрын
Thanks for this. I've been wanting to implement LUA in my game engine for quite some time, but never knew where to start, instead trying to manually create an interpreter for a simple C like language. I managed to get most things working except for converting the AST tree into actual instructions to run in my simple virtual machine which managed to melt my brain, so I gave it up for a while. Now I can scrap that and start implementing LUA. :)
@zadfoe
@zadfoe 3 жыл бұрын
Hows the game engine
@HTDBarsi
@HTDBarsi 3 жыл бұрын
hows the game engine
@Ruxify
@Ruxify 3 жыл бұрын
I'm supposed to be doing a rewrite on the render module (including implementing PBR) but I haven't touched it in a while.
@HTDBarsi
@HTDBarsi 3 жыл бұрын
@@Ruxify Oh thats cool!
@mooks500
@mooks500 2 жыл бұрын
damn thats badass
@LM555chip
@LM555chip 4 жыл бұрын
i just found this awesome channel recently. i like how you explain things simply. i also like how you approach critiques. like who cares really if you use system("pause") for convenience. nothing is taboo in programming imo, all options should be considered. congratulations for having so many subscribers, and you deserve more.
@RozzmanLists
@RozzmanLists 5 жыл бұрын
As always: very informative and very clear. Thank you for putting so much work and thought into your tutorials! I really appreciate what you offer
@javidx9
@javidx9 5 жыл бұрын
Thanks Rozzman, much appreciated!
@JordanXion
@JordanXion 5 жыл бұрын
Nice video - I'd like to see videos on how to integrate Lua more broadly with C++, with unknown code, in the context of game add-ons/mods specifically
@ragnarock811
@ragnarock811 2 жыл бұрын
I was modifying minetest to add custom function interfacing the clientmods without any understanding of this concept (although it worked), and now I watch this golden video explaining the basic I supposed to understand back in the day.. Good job, keep going!
@wowLinh
@wowLinh 5 жыл бұрын
I love LUA!! Only discovered it a couple of years ago and simply loved it. Great video explaining things, as usual!!. Love your channel keep it up!!
@javidx9
@javidx9 5 жыл бұрын
And as usual, thanks very much wowLinh! Gotta keep track of the early supporters now XD
@ipa_stor
@ipa_stor Жыл бұрын
That's crazy how good is your explanation. I accidentally got this video in recommendations (0 at cpp, almost 0 at lua) but wow, this content is 🤯 thanks. and one more "thanks" for you logging operations with language tag👍👍👍 definitely must watch more
@billowen3285
@billowen3285 5 жыл бұрын
40k subs? Man I remember 8k, so glad you're getting the growth you deserve
@javidx9
@javidx9 5 жыл бұрын
Hey thanks Bill, both for the kind comment and the long time support.
@ashrasmun1
@ashrasmun1 5 жыл бұрын
Fantastic! I was always fascinated with Lua from the day I've learned about it in WoW. Can't wait to use it in my C++ projects!
@harleyspeedthrust4013
@harleyspeedthrust4013 5 жыл бұрын
I've never really bothered with Lua but I'll have to check it out because this is cool. I usually use java, and my go-to solution for settings files was the reflection API because that made it easy to deal with type checking and such. You can have a class with all the fields named exactly as they are in the file and you can go through each line in the file and use reflection to get a field in the class by name and ensure that it's type matches with the type given in the file, then set the field to the value given in the file. You can't do more complicated stuff though, so I'll definitely have to take a look at this. Nice video, as always!
@gilney.mathias
@gilney.mathias 3 жыл бұрын
"C++ and Lua work very well together." Couldn't agree more! Playing around with Tibia's private servers for a couple of years was very cool ;p (and knowing that its a brazilian programming language makes it even better ;p huehue)
@storyseeker5387
@storyseeker5387 5 жыл бұрын
ty man. You gotta make more vids explaining more stuff. Really well explained here too, I'd love to see more
@Mythricia1988
@Mythricia1988 5 жыл бұрын
Haven't watched yet, but I look forward to! I've spent the last 6 months or so writing Lua code so it'll be interesting to see it from the other side of the fence, so to speak. Lua is lovely! And extremely fast with LuaJIT, too.
@javidx9
@javidx9 5 жыл бұрын
Lua is awesome on its own, it gains awesomness when smashed into C++ at 100mph XD
@Mythricia1988
@Mythricia1988 5 жыл бұрын
@@javidx9 Maybe it could be fun looking at other embeddable scripting languages too? Things like Wren seem really awesome, and is purposely designed to be embedded like this, too.
@frankluvsu21
@frankluvsu21 4 жыл бұрын
I am a beginner and the truth is that you explain very well.
@egdrei
@egdrei 4 жыл бұрын
Instantly subscribed 3 minutes into the video. Not because of the special nature of the video. But because it's clear your understanding of the topics are solid. Your explanations are direct and concise. I like that.
@dieSpinnt
@dieSpinnt 4 жыл бұрын
My sneaky rascal:) In the second example, the table-based configuration, you omitted the error checks. Thank you for the video.
@yan-amar
@yan-amar 5 жыл бұрын
I've been hearing about Lua for a long time, but this video really makes me want to use it.
5 жыл бұрын
This tutorial opens new galaxies for hobbyists. :) thanks again!
@javidx9
@javidx9 5 жыл бұрын
Hello Gurkan. It certainly does open up opportunities for hacking and playing. Loads of fun!
@samuelhurel6402
@samuelhurel6402 5 жыл бұрын
Grrrrr I'm so angry you don't code the exact same way as me! Nice tutorial, thanks for the video :)
@javidx9
@javidx9 5 жыл бұрын
Lol Samuel, you'd be surprised what my inbox gets these days XD Thanks buddy!
@aryanmn1569
@aryanmn1569 2 жыл бұрын
A masterpiece of explanation, barely possible to make big improvements on
@eminioxpl6651
@eminioxpl6651 5 жыл бұрын
Hah, I was just about to write small simple game in C++ with lua scripts to learn it and boom your video, thanks. You are my most trusted C++ information. I can't wait for more advanced stuff and see implemented lua in your game.
@javidx9
@javidx9 5 жыл бұрын
Thanks Eminiox, yeah Im looking forward to abusing Lua in my game too!
@trafficface
@trafficface 5 жыл бұрын
Thanks to this, I have Lua working in Web Assembly in node.js
@javidx9
@javidx9 5 жыл бұрын
Great stuff Adam!
@trafficface
@trafficface 5 жыл бұрын
@@javidx9 wip: github.com/acronamy/wasm-lua-node-tidal if your interested. Also I'd love to see some content for a game engine port to WASM in either node or browser. Blazor, cpp, rust or C.
@dromedda6810
@dromedda6810 Жыл бұрын
this makes it so clear, why game devs decide to use lua for modding support, or scripting. lua despite its wierdness is such a great tool to have
@MohammadHefny_HefnySco
@MohammadHefny_HefnySco 2 жыл бұрын
Great video .. . few days ago I knew nothing about lua.... now your video gave me a great push forward... many thanks for your effort.
@winifix
@winifix 5 жыл бұрын
Finally I understand it, and I was not even trying to study it, now i can fix my WoW bots :)
@drorraba5775
@drorraba5775 4 жыл бұрын
Hi, I think im having familiar problem in other MMO-RPG game, any chance you can contact me?
@isaidstream4547
@isaidstream4547 5 жыл бұрын
Im so happy you use Lua :D, There's a game called Transformice, and you can make minigames using Lua :D
@juhabach4802
@juhabach4802 5 жыл бұрын
And Roblox but the syntax is a little different
@kaleidodeer
@kaleidodeer 4 жыл бұрын
​@@juhabach4802 The syntax is the same, it just gets a lot of extra functions, tables, methods etc to represent the C++ environment. workspace for example is really just a table that simulates OOP. So Roblox isn't doing anything weird with their implementation. (Although they did just get a new and faster VM for Lua) Gideros is probably a better example for a implementation of Lua but with different syntax. Gideros has a couple of community patches added onto it. Shorthand operators and easier array syntax for example.
@giuseppefusco1189
@giuseppefusco1189 5 жыл бұрын
You deserve a lot more subscribers. I'm gonna share your channel with my friends 😊
@javidx9
@javidx9 5 жыл бұрын
Thanks Giuseppe, I dont actively publicise the channel anywhere, nor do I use social media with any effort, but yes, tell your friends! XD
@btatarov
@btatarov 5 жыл бұрын
You actually don't need to use for prints in lua :) Great tutorial
@dirtyblasion15
@dirtyblasion15 5 жыл бұрын
Stop hacking my browser history...I was just looking for this on google a few seconds ago
@javidx9
@javidx9 5 жыл бұрын
Ive got to get my ideas from somewhere DB XD
@SoftBreadSoft
@SoftBreadSoft 5 жыл бұрын
What the actual fuck me too this was creepy LOL
@drewestification
@drewestification 5 жыл бұрын
yeah same lol
@Music-sq8oy
@Music-sq8oy 5 жыл бұрын
omfg same lmao idk how
@noshit1128
@noshit1128 5 жыл бұрын
How the fuck are you guys still not aware of Google tracking and spying on you? Of course it will recommend videos on its own platform based on data it gathers from web pages which has Google's bullshit embedded in some way.
@stanosipenko7305
@stanosipenko7305 5 жыл бұрын
Finally, lua getting the love it deserves
@jamesgrimwood1285
@jamesgrimwood1285 5 жыл бұрын
This is a fun rabbit hole to fall down 😀
@javidx9
@javidx9 5 жыл бұрын
Yeah it is James, Ive done some crazy things with Lua and C++, they really work well as a pair
@cpuwolf
@cpuwolf 2 жыл бұрын
the best tutorial for me trying to embed Lua
@MoroZ4300
@MoroZ4300 5 жыл бұрын
Great video! I got into Lua after playing Project Zomboid.
@javidx9
@javidx9 5 жыл бұрын
Thanks Mahdi!
@paradisefallen8385
@paradisefallen8385 8 ай бұрын
Still petfect guide. I like how you show stack changes
@DiegoLopesCF
@DiegoLopesCF 5 жыл бұрын
Oh! look mah I'm in a video :D
@nettoribeiro4267
@nettoribeiro4267 4 жыл бұрын
que privilégio, cara
@floretion
@floretion 4 жыл бұрын
Can't recommend these videos enough!
@rigbyb
@rigbyb 9 ай бұрын
Your videos are so good! I wanted to learn how to embed Lua, and this video was insanely helpful. Thanks :)
@highbrAned
@highbrAned 5 жыл бұрын
these tutorials are so comfortably helpful. thank you !
@javidx9
@javidx9 5 жыл бұрын
Thanks Klaus, Im pleased its useful to you!
@ariseyhun2085
@ariseyhun2085 5 жыл бұрын
Explained it so damn clearly - Thank a lot for this video!
@teucay7374
@teucay7374 4 жыл бұрын
This is exactly what I was looking for. You are awesome!
@raoul4246
@raoul4246 5 жыл бұрын
great !! as usual its probably took me 1 week to fully understand the video :-)
@javidx9
@javidx9 5 жыл бұрын
Nah Raoul, you'll get this!
@nedok4724
@nedok4724 5 жыл бұрын
Great video. However, why use float for lua_HostFunction? To my knowledge, lua uses double as its internal representation for numbers and converting to float could lead to truncation errors. Maybe something to mention in the next installment
@Octavarium666xyz
@Octavarium666xyz 5 жыл бұрын
You are reading my mind. I was thinking about starting with LUA for past few days.
@javidx9
@javidx9 5 жыл бұрын
lol, its a fun language Ales, very fast too
@BlazertronGames
@BlazertronGames 3 жыл бұрын
Thanks for making this. It's way simpler than I thought it would be. I tried reading the lua documentation to figure this out, but there's no examples, just a function reference.
@flobuilds
@flobuilds 5 жыл бұрын
Thats really awesome you could make a command line where you can enter full formulas and execute them in c++
@javidx9
@javidx9 5 жыл бұрын
Thats right Bluestroker, and effectively if you install lua properly, that is exactly what the Lua command prompt does, you can enter full functions and objects and tables, all valid lua code this way.
@flobuilds
@flobuilds 5 жыл бұрын
@@javidx9 thanks i did not know that lua is awesome
@jsflood
@jsflood 5 жыл бұрын
Excellent explanation on a very interesting topic.
@xTheKnallstock
@xTheKnallstock 5 жыл бұрын
Hi David, again a very nice tutorial, as usual. I would like to ask you, if you can possibly make a video about the rvalue reference and move constructors in the future because, you always explained hard topics like polymorphism so good to me and I can imagine, you will also do it with that topic. Thanks for making this awesome videos. Greetings Knallstock
@javidx9
@javidx9 5 жыл бұрын
Thanks Kiba, I'll add it to the list. I'll need to find a suitable "delivery vehicle" that can exploit using these concepts in an interesting way.
@kyoai
@kyoai 5 жыл бұрын
Hey javidx9, have you heard of the Lua wrapper SOL2? If you're working a lot with C++-embedded Lua i highly recommend using it (you can find it on Github, a user named ThePhD created it). I've been using it for years and it's absolutely amazing... though, embarassingly, while i've been using Sol2 for years i never learned how the direct Lua-C++ boundary works (because Sol2 abstracts that away), so i'm looking forward to more videos in this "series". :)
@javidx9
@javidx9 5 жыл бұрын
Hi Stefan, I have heard of it. There are numerous Lua wrappers and binders available, though Ive always enjoyed the "connection" of doing it myself. I think if I was using Lua in my professional role, I wouldnt think twice about using a wrapper.
@fk115
@fk115 5 жыл бұрын
Thanks for this well explained and very educational video. One suggestion I would have, however, is that you should wear another clip-on microphone in all your videos during the side view in which you speak visibly. The differences in tone (clear off-voice compared to ambience sound with a reverb) are a little distracting and slightly semi-professional. But this is only a very small drop of imperfection, otherwise your videos are excellent and I would be happy if even more users would watch them.
@javidx9
@javidx9 5 жыл бұрын
Cheers, interesting... i used to use a clip on mic, but i didnt like the indistinct vocals at all. Personal tastes i suppose. I like the cutaways to be a little break in proceedings.
@Baile_an_Locha
@Baile_an_Locha 4 жыл бұрын
I was looking for a clear tutorial to bootstrap some of my team who need to make sense of a Lua PoC I did recently. Great job! Thanks. BTW, for anyone using VS, the easiest way to get Lua is to just reference it as a NuGet package. This will set up your include path, library path, and library name. No need for pragma, etc. Lastly, you don’t need to put the Lua includes in an extern C section if you’re working in C++. Just include the .hpp file instead.
@BlazertronGames
@BlazertronGames 3 жыл бұрын
including lua.hpp will do exactly what you've done with the extern C line.
@inx1819
@inx1819 2 жыл бұрын
thanks good to know
@seditt5146
@seditt5146 5 жыл бұрын
You sold me, ima incorporate LUA into my engine now. Thanks, now I have to add all sorts of other scripting stuff and its all your fault!
@javidx9
@javidx9 5 жыл бұрын
What have I done!!!???
@seditt5146
@seditt5146 5 жыл бұрын
@@javidx9 Its been a long time coming, I have known I needed some sort of scripter if for nothing else resource handling. Loading Sprite maps via code is a pain an is ugly, I would much rather have it in a separate source which I can define various attributes like w,h, x,y frame count etc..etc all that fun state information for various assets. I had intended on writing my own simple scripter but surely Lua will be more powerful than anything I intended to write and is already done for me.
@pendergastj
@pendergastj 5 жыл бұрын
Who the hell would dislike this?
@joelmanning249
@joelmanning249 Жыл бұрын
Very clear and concise with excellent examples.
@zaspanyflegmatyk2446
@zaspanyflegmatyk2446 5 жыл бұрын
PLLSSSS make a tutorial about cmake i cant find anything good and yours would be 10/10
@javidx9
@javidx9 5 жыл бұрын
lol thanks for the belief Zaspany, but I found CMake to be such a confusing mess I refused to use it. Maybe, one day... Though there are some cmake experts on the discord if you want to ask someone!
@madkouryt
@madkouryt 5 жыл бұрын
I agree that CMake is a mess mostly because of the legacy functions and the backward compatibility stuff, but it's rather a powerful tool if you are working on more than one platform or IDE, and also if you hate to go through all visual studio's properties tabs. I would recommend this talk "Florent Castelli: Introduction to CMake" by Florent Castelli: kzbin.info/www/bejne/oKWWnpiOmbVgh6s This talk uses modern CMake functions, also all the code is available at github as a tutorial.
@code-dredd
@code-dredd 5 жыл бұрын
Ahhh yes.... cmake, the thing you need to use for cross-platform project/compilation support only to discover it's a f(*&! language of its own and you can no longer focus on writing your originally intended code in the first place.... I don't like cmake and the docs suck as much as cmake itself >:d
@madkouryt
@madkouryt 5 жыл бұрын
@@code-dredd For small projects there is no need to use CMake, but if you are working on a corss-platform project/library that has dependencies on other libraries, and you have more than one contributor every one with his own favorite IDE/text editor, you have two choices: 1- Maintain multiple project files, then if you add just one source file you have to update and test all these project files. 2- Use CMake and maintain only CMakeLists.txt files, then every one generates projects files for his favorite IDE/tool chain. I would argue that for large project, it's easier to run with CMake, but if your project is small it isn't worth the hassle as you have to write some boilerplate when you can just click file-newproject and be done.
@notsalman
@notsalman 5 жыл бұрын
Zaspany Flegmatyk are you trying to do cmake on Linux?
@nl3146
@nl3146 3 жыл бұрын
BIG LIKE and thank you for the video. It' was very instructive and i learned a lot about Lua :D
@sudeepgopal
@sudeepgopal 3 жыл бұрын
Thank you so much - Really appreciate the work you have done...
@veda-powered
@veda-powered 5 жыл бұрын
Just one thing I noticed: because lua5.3 has native support for integers it would be better to call lua_tointeger instead of lua_tonumber and casting to an int.
@javidx9
@javidx9 5 жыл бұрын
You are quite right Ben of course, it does support integers, but at this stage in the series I think just number was clear enough. The code I uploaded to accompany the video does use tointeger conversions.
@August0Moura
@August0Moura 5 жыл бұрын
great video, I use Lua for everything, as adding scripting to C++ programs or very quickly automate repetitive tasks without recompiling (i also use it on my ESP32) p.s.: 19:23 i would use player.title = "Squire" as it's more simple
@SrIgort
@SrIgort 5 жыл бұрын
E esse Dollynho aí kkk
@August0Moura
@August0Moura 5 жыл бұрын
@@SrIgort kkkk modelei ele só de brincadeira, queria fazer um mini joguinho de zueira mas acabei desistindo, mas depois dum tempo corrigi algumas coisas nele e adicionei ele no jogo VRChat no mapa "Dollynho Brasil" :P
@xemuth1643
@xemuth1643 4 жыл бұрын
Awesome vid ! I will use it to externalise some behavior on my 3d viewer !
@karlkastor
@karlkastor 5 жыл бұрын
Interesting. My old company embedded Lua directly into C++ for preprocessing like e.g. internationalization. So you'd first run Lua on the source code to get the final C++ source code and then you could compile the C++.
@АлексейСалихов-з4ч
@АлексейСалихов-з4ч 5 жыл бұрын
0:33 It's also very useful for businesses and industry to be able to modify their programs vapidly
@СергейФёдоров-щ8ш
@СергейФёдоров-щ8ш 5 жыл бұрын
Very easy description for lua basics! thanx ) What about userdata, and lightuserdata, with images in next tutorial? ) (or effictive share dynamic array of structs between host and lua script, in both direction)
@javidx9
@javidx9 5 жыл бұрын
Thanks, yes I'll be covering lightuserdata in a follow up video, I find it very useful for shifting pointers to objects around.
@itryen7632
@itryen7632 2 жыл бұрын
É TRETAAAAA 🇧🇷🇧🇷🇧🇷🇧🇷👍🏻👍🏻👍🏻👍🏻👍🏻
@justgame5508
@justgame5508 5 жыл бұрын
I always store file settings as text then write my own parser and read them in using regular expression or something similar, just using Lua looks a lot safer and simpler. Nice
@levshx
@levshx 2 жыл бұрын
thanks, I studied imgui and opengl, now I can make a 3d game engine with api LUA
@justsomedude5108
@justsomedude5108 5 жыл бұрын
javidx9 your channel is excellent. Please demonstrate how to draw 2d isometric tiles and sprites. There's lots of tutorials showing how to draw the artwork but I find anything about the programming of them. It would be awesome if you could cover how to calculate the movement when the view is isometric too. Thanks for everything you share!
@javidx9
@javidx9 5 жыл бұрын
I would like to explore isometry too at some point so it is definitely on my list of things to demonstrate.
@justsomedude5108
@justsomedude5108 5 жыл бұрын
@@javidx9 I can't wait until you do! I loved games like Diablo and Starcraft. I'll keep a look out for your videos. Thanks again
@syne1456
@syne1456 5 жыл бұрын
have been waiting for this for soo long, thank you!
@javidx9
@javidx9 5 жыл бұрын
I hope its useful to you Syne!
@syne1456
@syne1456 5 жыл бұрын
@@javidx9 it was thanks!
@Ben-up4lj
@Ben-up4lj 5 жыл бұрын
Good morning Javid, I'm following you about some month now and see that you're using C++ heavily. I'm a engineer and more focused on C, never learned C++ properly. I guess you are good in C too, so it would be nice if you can a video why you changed to C++ and who you see the advantages. There are already some videos about the languages but I like to watch what you think in this special case (C vs C++). Keep it going, your channel satisfying my brain :).
@javidx9
@javidx9 5 жыл бұрын
Hi Ben, I did start with C (Turbo C to be precise), but swiftly moved on to C++. It is my opinion (no doubt a controversial one) that there is literally no point in learning C anymore. Even embedded platforms have a growing number of C++ implementations available to them. The nice thing about C++ is you can pick and choose whether or not you need the Object Orientation capabilities. Again, in my opinion, these things are useful even for trivial tasks regardless of how your system design is constructed. If you can program in C++, you would find the migration to "pure" C quite trivial. BUT! And its a big but, the way C++ is presented these days is to actively avoid using C like constructions and syntax - something which I disagree with. I believe you should program in the style that solves your problem with the least resistance, and if a C like project structure is better for what you are doing, then run with it. Perhaps not necessarily the answer you were looking for, but I like to be honest. Thanks for watching though, I like to think the way I make my videos you could reproduce the core content in almost any language.
@cocbuilds
@cocbuilds 5 жыл бұрын
Lua is great.
@javidx9
@javidx9 5 жыл бұрын
Agreed.
@edmondmovsisyan2224
@edmondmovsisyan2224 4 жыл бұрын
27:45 how could I make the c program sensitive to the text file changes?
@Philippe-ch6uk
@Philippe-ch6uk 5 жыл бұрын
I love your videos ! Keep up good work !
@javidx9
@javidx9 5 жыл бұрын
I appreciate that Philippe, I Will!
@marcoalejandrosalas1066
@marcoalejandrosalas1066 3 жыл бұрын
I want to understand and have something clear, since I am a learner in this world of programming and that, in this tutorial it is taught clearly and "practically", how to execute Lua code or Lua itself in a C ++ program. If so please affirm me to know that I have learned something great for future project applications, thank you
@shorthouse06
@shorthouse06 4 жыл бұрын
Great video, really easy to follow and understand. Do you still have plans to continue this series?
@javidx9
@javidx9 4 жыл бұрын
Thanks! I think i might, the #1 doesnt indicate a series, its just the first c++ and lua video. That said, theres a lot more detail to go into, so yeah, probably!
@diegorosadossantos8493
@diegorosadossantos8493 4 жыл бұрын
That was an amazing lecture, thank you for sharing
@neozoan
@neozoan 5 жыл бұрын
Excellently done. Thanks!
@javidx9
@javidx9 5 жыл бұрын
Thank you Daniel!
@asmbaty
@asmbaty 3 жыл бұрын
Great introduction! Thank you!
@TailsFinance777
@TailsFinance777 3 жыл бұрын
interesting language in terms of automating tasks and speeding up them.
@Shadow-bc5nr
@Shadow-bc5nr 2 жыл бұрын
Thanks alot for creating this video!
@atrumluminarium
@atrumluminarium 5 жыл бұрын
Here's a bit of a wordy question: So say I am writing a Lua script. In this script I define a function matMul(a,b) that takes in two matrices and multiplies them the normal way we multiply matrices. This function was chosen because it's generally an operation that involves a heavy workload, ~O(n³) to be exact After this video, now I know that I have two options: • write the entire function within the Lua script as "pure Lua" • write the function such that it lets C++ do all the grunt work and Lua just handles the initial and final values As an intermediate level programmer, I would be inclined to think that for large work loads, the low-level Lua/C++ would out-perform the high-level Lua/Lua since it allows for more detailed optimisation (especially if considering frameworks like OpenMP and OpenCL for parallelism). My question is, would it possible to discuss this by showing a few benchmark comparisons in a future episode? I was tinkering with this particular concept a while back but there is little info about it. Maybe having an episode about comparisons would lead people easier to this video where you discuss the "how to" aspects. Also thanks for the video, like I said this issue was driving me nuts trying to figure out before I saw this video :)
@javidx9
@javidx9 5 жыл бұрын
Hey atrum, your instincts are correct. Do the grunt work in optimised C++ code. And call that from lua. This is how most systems that use lua should work. Which can make defining the boundary between whether your program is mostly a C++ or a Lua one a little blurred. I will be following up this video showing more complex interactions between the two.
@atrumluminarium
@atrumluminarium 5 жыл бұрын
@@javidx9 Thank you :)
@rol1939
@rol1939 5 жыл бұрын
The biggest problem is the garbage collection in Lua. It generates cpu bursts. That's why the squirrel language was created.
@ProgrammerSheep
@ProgrammerSheep 5 жыл бұрын
You should do an OpenGl series.
@veda-powered
@veda-powered 5 жыл бұрын
I would recommend that you look at some of these examples: www.opengl.org/archives/resources/code/samples/glut_examples/examples/examples.html to learn the basics of OpenGL, then try and transition to modern OpenGL which is much more complicated in my opinion and being able to slowly transition every thing from the old way (fixed pipeline) over to the new way is way nicer then having to write a shader just to get anything to show up
@Dadaskis
@Dadaskis 5 жыл бұрын
learnopengl.com is your choice
@AquesticYT
@AquesticYT 5 жыл бұрын
@@veda-powered GLUT is old. Use GLFW.
@veda-powered
@veda-powered 5 жыл бұрын
@@AquesticYT You're right, but I personally believe that it's simpler then GLFW, so easier to learn.
@inanitas
@inanitas 5 жыл бұрын
@@veda-powered Nah modern is easier if you don't get used to old pipeline. It's like saying "Learn Basic on MSDOS before you learn C++ on Windows". On the other hand, I did start programming by learning C++ and Assembler back in 2015, so I just might find the hard things easier.
@davidbundgaard
@davidbundgaard 4 жыл бұрын
@javidx9 Hi, good work on this topic, have you considered what you want to for part #2, if such ever will exist?
@xx512
@xx512 5 жыл бұрын
Beautiful. More please!
@davidste60
@davidste60 5 жыл бұрын
Nice video, I'm looking forward to more in this series. This Lua VM seems quite forth-like, does it have a seperate return stack?
@DavePoo
@DavePoo 5 жыл бұрын
I quote the Lua manual "Whenever Lua calls C, the called function gets a new stack, which is independent of previous stacks and of stacks of C functions that are still active."
@davidste60
@davidste60 5 жыл бұрын
@@DavePoo - Thanks but I meant a stack just for return addresses, not parameters. I guess not though. Forth has two stacks.
@krenciak
@krenciak 5 жыл бұрын
Please make a second part!!
@matthewburren8563
@matthewburren8563 5 жыл бұрын
Your channel is a blessing
@Gilded_God
@Gilded_God 3 жыл бұрын
Very nice video I really like your content.
@rzDmyth
@rzDmyth Жыл бұрын
any chance of covering how to set up Lua with Visual Studio 2022 and Open 3D Engine? Install, debug, watch variables, autocomplete/IntelliSense, etc... Great video btw
@selfhelp441
@selfhelp441 2 жыл бұрын
great video! where can i find what libraries are included in lualibs?
@rockyrivermushrooms529
@rockyrivermushrooms529 5 жыл бұрын
Id like to see some python related videos. and maybe some engineering related C++ videos!
@lufog
@lufog 4 жыл бұрын
Working source link: github.com/OneLoneCoder/videos/blob/master/OneLoneCoder_EmbeddingLua_Part1.cpp
@unevenprankster
@unevenprankster 5 жыл бұрын
I was waiting for this.
@javidx9
@javidx9 5 жыл бұрын
Hey Prankster, its a basic look at embedding, but I gotta start somewhere :D
@urugulu1656
@urugulu1656 5 жыл бұрын
nice one ! only one Question : what did ya do to get rid of that sorta ever neccessary stdafx.h that visual Studio puts in everytime without it complaining on that?
@dynamagon
@dynamagon 2 жыл бұрын
Would this work in C? I'm actually going to use the engine I made with the help of your 3d engine series to make games!
@timkim1967
@timkim1967 5 жыл бұрын
Thank you for all your videos you are a extremely skilled programmer. I’m just curious about something, how can I use multiple different objects for the same memory slot? For example if I wanted multiple different characters inserted into my game, how can I use the same memory slots so I don’t overload and/or slow down the program?
@alessandroculatti1613
@alessandroculatti1613 3 жыл бұрын
Regarding the example of storing the settings in an external file, is there any particular reason to use a scripting language over a file type meant to store values, like a json file?
@javidx9
@javidx9 3 жыл бұрын
It entirely depends on what you need to store, but it can be pretty awesome to have a config file with dynamic attributes. An exaggerated example. You store your application window size in the config file. But a dynamic one could actually determine the best window size and provide that, without needing any modification of your existing code.
@alessandroculatti1613
@alessandroculatti1613 3 жыл бұрын
@@javidx9 That would be a cool feature to have, I can see why a dynamic config file could be useful
Automating Sequences via Lua Coroutines in C++
45:23
javidx9
Рет қаралды 59 М.
Intrinsic Functions - Vector Processing Extensions
55:39
javidx9
Рет қаралды 126 М.
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 22 МЛН
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
Embedding Lua in C++ Part 3: Meh... Just use Sol...
31:10
javidx9
Рет қаралды 28 М.
Forbidden C++
33:07
javidx9
Рет қаралды 1 МЛН
Cross Platform Graphical User Interfaces in C++
44:49
javidx9
Рет қаралды 872 М.
What Are Pointers? (C++)
41:55
javidx9
Рет қаралды 564 М.
Essential Mathematics For Aspiring Game Developers
47:06
javidx9
Рет қаралды 393 М.
Back To Basics: C++ Containers
31:41
javidx9
Рет қаралды 188 М.
BEST WAY to make Desktop Applications in C++
26:00
The Cherno
Рет қаралды 934 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 22 МЛН