Embedding Lua in C++ #1

  Рет қаралды 178,970

javidx9

javidx9

Күн бұрын

Пікірлер: 380
@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 10 ай бұрын
People that do shit like that are stupid
@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 6 ай бұрын
2 years to get this level of fluency. Good for you, mate!
@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.
@DiegoLopesCF
@DiegoLopesCF 5 жыл бұрын
Oh! look mah I'm in a video :D
@nettoribeiro4267
@nettoribeiro4267 4 жыл бұрын
que privilégio, cara
@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!
@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.
@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!
@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
@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
@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
@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)
@stanosipenko7305
@stanosipenko7305 5 жыл бұрын
Finally, lua getting the love it deserves
@floretion
@floretion 4 жыл бұрын
Can't recommend these videos enough!
@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!
@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.
@derf6060
@derf6060 Ай бұрын
Thanks you... This video was a big help with my understand of the lua stack which has eluded me for years.
@frankluvsu21
@frankluvsu21 4 жыл бұрын
I am a beginner and the truth is that you explain very well.
@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.
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!
@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.
@dieSpinnt
@dieSpinnt 4 жыл бұрын
My sneaky rascal:) In the second example, the table-based configuration, you omitted the error checks. Thank you for the video.
@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
@storyseeker5387
@storyseeker5387 5 жыл бұрын
ty man. You gotta make more vids explaining more stuff. Really well explained here too, I'd love to see more
@MohammadHefny_HefnySco
@MohammadHefny_HefnySco 3 жыл бұрын
Great video .. . few days ago I knew nothing about lua.... now your video gave me a great push forward... many thanks for your effort.
@aryanmn1569
@aryanmn1569 2 жыл бұрын
A masterpiece of explanation, barely possible to make big improvements on
@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
@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?
@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.
@rigbyb
@rigbyb 11 ай бұрын
Your videos are so good! I wanted to learn how to embed Lua, and this video was insanely helpful. Thanks :)
@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!
@edmondmovsisyan2224
@edmondmovsisyan2224 4 жыл бұрын
27:45 how could I make the c program sensitive to the text file changes?
@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!
@teucay7374
@teucay7374 4 жыл бұрын
This is exactly what I was looking for. You are awesome!
@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
@highbrAned
@highbrAned 5 жыл бұрын
these tutorials are so comfortably helpful. thank you !
@javidx9
@javidx9 5 жыл бұрын
Thanks Klaus, Im pleased its useful to you!
@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 5 жыл бұрын
​@@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.
@cpuwolf
@cpuwolf 3 жыл бұрын
the best tutorial for me trying to embed Lua
@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!
@joelmanning249
@joelmanning249 2 жыл бұрын
Very clear and concise with excellent examples.
@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
@MoroZ4300
@MoroZ4300 5 жыл бұрын
Great video! I got into Lua after playing Project Zomboid.
@javidx9
@javidx9 5 жыл бұрын
Thanks Mahdi!
@paradisefallen8385
@paradisefallen8385 9 ай бұрын
Still petfect guide. I like how you show stack changes
@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.
@btatarov
@btatarov 5 жыл бұрын
You actually don't need to use for prints in lua :) Great tutorial
@jsflood
@jsflood 5 жыл бұрын
Excellent explanation on a very interesting topic.
@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?
@Philippe-ch6uk
@Philippe-ch6uk 5 жыл бұрын
I love your videos ! Keep up good work !
@javidx9
@javidx9 5 жыл бұрын
I appreciate that Philippe, I Will!
@tqwewe
@tqwewe 5 жыл бұрын
Explained it so damn clearly - Thank a lot for this video!
@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!
@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.
@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
@nl3146
@nl3146 3 жыл бұрын
BIG LIKE and thank you for the video. It' was very instructive and i learned a lot about Lua :D
@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 :)
@matthewburren8563
@matthewburren8563 5 жыл бұрын
Your channel is a blessing
@neozoan
@neozoan 5 жыл бұрын
Excellently done. Thanks!
@javidx9
@javidx9 5 жыл бұрын
Thank you Daniel!
@sudeepgopal
@sudeepgopal 3 жыл бұрын
Thank you so much - Really appreciate the work you have done...
@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
@diegorosadossantos8493
@diegorosadossantos8493 4 жыл бұрын
That was an amazing lecture, thank you for sharing
@Shadow-bc5nr
@Shadow-bc5nr 2 жыл бұрын
Thanks alot for creating this video!
@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.
@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
@asmbaty
@asmbaty 3 жыл бұрын
Great introduction! Thank you!
@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
@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
@xx512
@xx512 5 жыл бұрын
Beautiful. More please!
@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
@pendergastj
@pendergastj 5 жыл бұрын
Who the hell would dislike this?
@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.
@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.
@xemuth1643
@xemuth1643 4 жыл бұрын
Awesome vid ! I will use it to externalise some behavior on my 3d viewer !
@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.
@itryen7632
@itryen7632 2 жыл бұрын
É TRETAAAAA 🇧🇷🇧🇷🇧🇷🇧🇷👍🏻👍🏻👍🏻👍🏻👍🏻
@АлексейСалихов-з4ч
@АлексейСалихов-з4ч 5 жыл бұрын
0:33 It's also very useful for businesses and industry to be able to modify their programs vapidly
@alessandroculatti1613
@alessandroculatti1613 4 жыл бұрын
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 4 жыл бұрын
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 4 жыл бұрын
@@javidx9 That would be a cool feature to have, I can see why a dynamic config file could be useful
@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!
@СергейФёдоров-щ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.
@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.
@Gilded_God
@Gilded_God 3 жыл бұрын
Very nice video I really like your content.
@CoolDude911
@CoolDude911 3 жыл бұрын
I have a question about the size of the stack. Is it standard practice to pop the stack after saving a global lua variable to a C variable? When a fixed amount of global vars are read I guess it does not matter but would you pop or clear the stack at certain points as standard practice to avoid the lua stack getting too big?
@javidx9
@javidx9 3 жыл бұрын
Managing the Lua stack is "on the whole" automatic, but there are instances where you need to do it yourself. You'll realise when, because your memory consumption will always be increasing XD
@CoolDude911
@CoolDude911 3 жыл бұрын
@@javidx9 Cool thank you for making these videos.
@selfhelp441
@selfhelp441 2 жыл бұрын
great video! where can i find what libraries are included in lualibs?
@JAdHum
@JAdHum 4 жыл бұрын
I am following this exactly and I'm getting "error LNK2019: unresolved external symbol _luaL_newstate referenced in function _main." How do I fix? None of the tutorials on the internet are working for me
@glowiever
@glowiever 4 жыл бұрын
you gotta wrap your lua include within extern "C" {} block. check the beginning of this video
@jurdendurden
@jurdendurden 4 жыл бұрын
Love your work, thank you.
@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
@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
@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!
@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.
@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.
@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?
@cocbuilds
@cocbuilds 5 жыл бұрын
Lua is great.
@javidx9
@javidx9 5 жыл бұрын
Agreed.
@szczypiorofixable
@szczypiorofixable 5 жыл бұрын
Thank you for your tutorial! :)
@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
@Johannes00
@Johannes00 4 жыл бұрын
Hi! :) I have a question. Constantly error checking every LUA variable (or parts of the external LUA script) seems very tedious to me. Isn't there a simple but speedy way to loop through the code / script that needs to get the C++ "it's not malicious LUA" stamp of approval?
@javidx9
@javidx9 4 жыл бұрын
Hi Johannes, Im afraid its not that simple. If you know your lua is just for you, then only error check what you need to. This is quite a common thing, all your lua files could be embedded in your executable for example. As soon as you open up your program to running unknown code there is risk. One way to help reduce risk is to only prime the lua vm with the libs that you need, so if you dont give it the file handling library for example, the users code wont be able to open files...
@Johannes00
@Johannes00 4 жыл бұрын
​@@javidx9 Thank you for the quick reply! Well, I guess I just have to buckle up and hunker down with learning the proper ways then. At least I feel that with the help of your videos over the years, I have been able to push myself past the point where I'd usually give up! (But I often have trouble staying focused on learning one thing at a time, hehe)
@rishiniranjan1746
@rishiniranjan1746 3 жыл бұрын
Beautiful and interesting
@gunhatornie
@gunhatornie 8 ай бұрын
SUPA REM IC
@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.
@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++.
@يمرحويتعلم
@يمرحويتعلم 2 жыл бұрын
I designed an application to protect videos, but how do I prevent screen recording and video recording programs during presentation?
@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
What Are Pointers? (C++)
41:55
javidx9
Рет қаралды 565 М.
Automating Sequences via Lua Coroutines in C++
45:23
javidx9
Рет қаралды 60 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Introducing Clay - High Performance UI Layout in C
35:19
Nic Barker
Рет қаралды 154 М.
What is the Smallest Possible .EXE?
17:04
Inkbox
Рет қаралды 561 М.
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 223 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1 МЛН
The Ultimate Tier Programming Tier List | Prime Reacts
26:57
ThePrimeTime
Рет қаралды 511 М.
TWISTED: The dramatic history of twisted-pair Ethernet
28:30
The Serial Port
Рет қаралды 327 М.
NeovimConf 2022: Lua, a Primer
30:10
John McBride
Рет қаралды 20 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 768 М.
Dithering with Floyd-Steinberg in C++
26:53
javidx9
Рет қаралды 55 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН