Embedding Lua in C++ #1

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 มิ.ย. 2024
  • C++ and Lua work very well together. Using Lua you can create modifiable programs by embedding it into your C++ program. In this video I take an introductory look at enabling data transactions between C++ and Lua.
    Source: github.com/OneLoneCoder/Javid...
    TH-cam: / javidx9
    / javidx9extra
    Discord: / discord
    Twitter: / javidx9
    Twitch: / javidx9
    GitHub: www.github.com/onelonecoder
    Patreon: / javidx9
    Homepage: www.onelonecoder.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 376

  • @robinvanderploeg5485
    @robinvanderploeg5485 5 ปีที่แล้ว +131

    "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 4 หลายเดือนก่อน

      People that do shit like that are stupid

  • @bigcrazycarboy672
    @bigcrazycarboy672 3 ปีที่แล้ว +59

    This has got to be the best tutorial on TH-cam 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.

  • @GTR487
    @GTR487 2 ปีที่แล้ว +7

    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 วันที่ผ่านมา

      2 years to get this level of fluency. Good for you, mate!

  • @ashrasmun1
    @ashrasmun1 5 ปีที่แล้ว +3

    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!

  • @LM555chip
    @LM555chip 3 ปีที่แล้ว +6

    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 ปีที่แล้ว +24

    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 ปีที่แล้ว +1

      Thanks Rozzman, much appreciated!

  • @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!

  • @storyseeker5387
    @storyseeker5387 5 ปีที่แล้ว +5

    ty man. You gotta make more vids explaining more stuff. Really well explained here too, I'd love to see more

  • @wowLinh
    @wowLinh 5 ปีที่แล้ว +4

    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 ปีที่แล้ว +1

      And as usual, thanks very much wowLinh! Gotta keep track of the early supporters now XD

  • @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.

  • @JordanXion
    @JordanXion 5 ปีที่แล้ว +11

    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

  • @Ruxify
    @Ruxify 5 ปีที่แล้ว +58

    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 2 ปีที่แล้ว +1

      Hows the game engine

    • @HTDBarsi
      @HTDBarsi 2 ปีที่แล้ว

      hows the game engine

    • @Ruxify
      @Ruxify 2 ปีที่แล้ว +4

      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 2 ปีที่แล้ว

      @@Ruxify Oh thats cool!

    • @mooks500
      @mooks500 2 ปีที่แล้ว

      damn thats badass

  • @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

  • @harleyspeedthrust4013
    @harleyspeedthrust4013 5 ปีที่แล้ว +2

    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!

  • @yan-amar
    @yan-amar 5 ปีที่แล้ว +1

    I've been hearing about Lua for a long time, but this video really makes me want to use it.

  • @billowen3285
    @billowen3285 5 ปีที่แล้ว +8

    40k subs? Man I remember 8k, so glad you're getting the growth you deserve

    • @javidx9
      @javidx9  5 ปีที่แล้ว +6

      Hey thanks Bill, both for the kind comment and the long time support.

  • @teucay7374
    @teucay7374 4 ปีที่แล้ว +2

    This is exactly what I was looking for. You are awesome!

  • @DiegoLopesCF
    @DiegoLopesCF 5 ปีที่แล้ว +69

    Oh! look mah I'm in a video :D

  • @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.

  • @floretionguru2977
    @floretionguru2977 4 ปีที่แล้ว +4

    Can't recommend these videos enough!

  • @dieSpinnt
    @dieSpinnt 3 ปีที่แล้ว

    My sneaky rascal:) In the second example, the table-based configuration, you omitted the error checks.
    Thank you for the video.

  • @highbrAned
    @highbrAned 5 ปีที่แล้ว +2

    these tutorials are so comfortably helpful.
    thank you !

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thanks Klaus, Im pleased its useful to you!

  • @giuseppefusco1189
    @giuseppefusco1189 5 ปีที่แล้ว +1

    You deserve a lot more subscribers. I'm gonna share your channel with my friends 😊

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      Thanks Giuseppe, I dont actively publicise the channel anywhere, nor do I use social media with any effort, but yes, tell your friends! XD

  • @jsflood
    @jsflood 5 ปีที่แล้ว +1

    Excellent explanation on a very interesting topic.

  • @ariseyhun2085
    @ariseyhun2085 5 ปีที่แล้ว +3

    Explained it so damn clearly - Thank a lot for this video!

  • @diegorosadossantos8493
    @diegorosadossantos8493 4 ปีที่แล้ว

    That was an amazing lecture, thank you for sharing

  • @joelmanning249
    @joelmanning249 ปีที่แล้ว

    Very clear and concise with excellent examples.

  • @rigbyb
    @rigbyb 4 หลายเดือนก่อน

    Your videos are so good! I wanted to learn how to embed Lua, and this video was insanely helpful. Thanks :)

  • @stanosipenko7305
    @stanosipenko7305 5 ปีที่แล้ว +5

    Finally, lua getting the love it deserves

  • @aryanmn1569
    @aryanmn1569 ปีที่แล้ว

    A masterpiece of explanation, barely possible to make big improvements on

  • @xx512
    @xx512 5 ปีที่แล้ว +1

    Beautiful. More please!

  • @asmbaty
    @asmbaty 3 ปีที่แล้ว

    Great introduction! Thank you!

  • @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 2 ปีที่แล้ว

    Thank you so much - Really appreciate the work you have done...

  •  5 ปีที่แล้ว +4

    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!

  • @matthewburren8563
    @matthewburren8563 4 ปีที่แล้ว

    Your channel is a blessing

  • @gilneyn.mathias1134
    @gilneyn.mathias1134 3 ปีที่แล้ว +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)

  • @cpuwolf
    @cpuwolf 2 ปีที่แล้ว

    the best tutorial for me trying to embed Lua

  • @Mythricia1988
    @Mythricia1988 5 ปีที่แล้ว +3

    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 ปีที่แล้ว +1

      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 3 ปีที่แล้ว

    I am a beginner and the truth is that you explain very well.

  • @Shadow-bc5nr
    @Shadow-bc5nr 2 ปีที่แล้ว

    Thanks alot for creating this video!

  • @syne1456
    @syne1456 5 ปีที่แล้ว +1

    have been waiting for this for soo long, thank you!

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      I hope its useful to you Syne!

    • @syne1456
      @syne1456 5 ปีที่แล้ว

      @@javidx9 it was thanks!

  • @Philippe-ch6uk
    @Philippe-ch6uk 5 ปีที่แล้ว +2

    I love your videos ! Keep up good work !

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      I appreciate that Philippe, I Will!

  • @neozoan
    @neozoan 5 ปีที่แล้ว +1

    Excellently done. Thanks!

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thank you Daniel!

  • @jurdendurden
    @jurdendurden 4 ปีที่แล้ว

    Love your work, thank you.

  • @paradisefallen8385
    @paradisefallen8385 2 หลายเดือนก่อน

    Still petfect guide. I like how you show stack changes

  • @MoroZ4300
    @MoroZ4300 5 ปีที่แล้ว +1

    Great video! I got into Lua after playing Project Zomboid.

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thanks Mahdi!

  • @szczypiorofixable
    @szczypiorofixable 5 ปีที่แล้ว +1

    Thank you for your tutorial! :)

  • @jamesgrimwood1285
    @jamesgrimwood1285 5 ปีที่แล้ว +3

    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

  • @xemuth1643
    @xemuth1643 3 ปีที่แล้ว

    Awesome vid ! I will use it to externalise some behavior on my 3d viewer !

  • @winifix
    @winifix 5 ปีที่แล้ว +4

    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?

  • @Michael-hs8gs
    @Michael-hs8gs 3 ปีที่แล้ว

    Very nice video I really like your content.

  • @trafficface
    @trafficface 5 ปีที่แล้ว +2

    Thanks to this, I have Lua working in Web Assembly in node.js

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      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.

  • @samuelhurel6402
    @samuelhurel6402 5 ปีที่แล้ว +8

    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!

  • @unevenprankster
    @unevenprankster 5 ปีที่แล้ว +1

    I was waiting for this.

    • @javidx9
      @javidx9  5 ปีที่แล้ว +1

      Hey Prankster, its a basic look at embedding, but I gotta start somewhere :D

  • @zatochiSiberian
    @zatochiSiberian 3 ปีที่แล้ว

    Great video! Thanks)

  • @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.

  • @eminioxpl6651
    @eminioxpl6651 5 ปีที่แล้ว +3

    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!

  • @rishiniranjan1746
    @rishiniranjan1746 3 ปีที่แล้ว

    Beautiful and interesting

  • @isaidstream4547
    @isaidstream4547 5 ปีที่แล้ว +8

    Im so happy you use Lua :D, There's a game called Transformice, and you can make minigames using Lua :D

    • @juhabach4802
      @juhabach4802 5 ปีที่แล้ว +1

      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.

  • @raoul4246
    @raoul4246 5 ปีที่แล้ว +2

    great !! as usual its probably took me 1 week to fully understand the video :-)

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Nah Raoul, you'll get this!

  • @btatarov
    @btatarov 5 ปีที่แล้ว +5

    You actually don't need to use
    for prints in lua :) Great tutorial

  • @bakioztepe
    @bakioztepe 4 ปีที่แล้ว

    You sir are a great helper :)

  • @Bbdu75yg
    @Bbdu75yg ปีที่แล้ว

    Amazing !!

  • @SapphFire
    @SapphFire 5 ปีที่แล้ว +1

    Thank you!

  • @nedok4724
    @nedok4724 5 ปีที่แล้ว +4

    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 ปีที่แล้ว +1

    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

  • @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

  • @xTheKnallstock
    @xTheKnallstock 5 ปีที่แล้ว +3

    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 ปีที่แล้ว +1

      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.

  • @krenciak
    @krenciak 5 ปีที่แล้ว

    Please make a second part!!

  • @lufog
    @lufog 4 ปีที่แล้ว +2

    Working source link: github.com/OneLoneCoder/videos/blob/master/OneLoneCoder_EmbeddingLua_Part1.cpp

  • @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?

  • @jonteboimakesgames
    @jonteboimakesgames 5 ปีที่แล้ว +1

    Nice tutorial!

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Thanks Seashore!

    • @jonteboimakesgames
      @jonteboimakesgames 5 ปีที่แล้ว

      Np as a awesome creator you diserve it!

  • @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?

  • @user-pm2ru6ir6n
    @user-pm2ru6ir6n 5 ปีที่แล้ว +2

    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 ปีที่แล้ว +2

      Thanks, yes I'll be covering lightuserdata in a follow up video, I find it very useful for shifting pointers to objects around.

  • @Shorthouse061
    @Shorthouse061 4 ปีที่แล้ว

    Great video, really easy to follow and understand.
    Do you still have plans to continue this series?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      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!

  • @dirtyblasion15
    @dirtyblasion15 5 ปีที่แล้ว +21

    Stop hacking my browser history...I was just looking for this on google a few seconds ago

    • @javidx9
      @javidx9  5 ปีที่แล้ว +15

      Ive got to get my ideas from somewhere DB XD

    • @SoftBreadSoftware
      @SoftBreadSoftware 5 ปีที่แล้ว +2

      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 ปีที่แล้ว +1

      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.

  • @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++.

  • @kyoai
    @kyoai 5 ปีที่แล้ว +2

    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 ปีที่แล้ว +2

      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 ปีที่แล้ว +1

    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 ปีที่แล้ว +3

      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.

  • @selfhelp441
    @selfhelp441 ปีที่แล้ว

    great video! where can i find what libraries are included in lualibs?

  • @flobuilds
    @flobuilds 5 ปีที่แล้ว +1

    Thats really awesome you could make a command line where you can enter full formulas and execute them in c++

    • @javidx9
      @javidx9  5 ปีที่แล้ว +2

      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

  • @rockyrivermushrooms529
    @rockyrivermushrooms529 5 ปีที่แล้ว +1

    Id like to see some python related videos. and maybe some engineering related C++ videos!

  • @Noob-ot8rf
    @Noob-ot8rf ปีที่แล้ว

    i love lua

  • @edmondmovsisyan2224
    @edmondmovsisyan2224 3 ปีที่แล้ว +3

    27:45 how could I make the c program sensitive to the text file changes?

  • @itryen7632
    @itryen7632 ปีที่แล้ว +1

    É TRETAAAAA 🇧🇷🇧🇷🇧🇷🇧🇷👍🏻👍🏻👍🏻👍🏻👍🏻

  • @rzDmyth
    @rzDmyth 9 หลายเดือนก่อน

    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

  • @levshx
    @levshx ปีที่แล้ว

    thanks, I studied imgui and opengl, now I can make a 3d game engine with api LUA

  • @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?

  • @zaspanyflegmatyk2446
    @zaspanyflegmatyk2446 5 ปีที่แล้ว +121

    PLLSSSS make a tutorial about cmake i cant find anything good and yours would be 10/10

    • @javidx9
      @javidx9  5 ปีที่แล้ว +59

      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 ปีที่แล้ว +8

      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:
      th-cam.com/video/jt3meXdP-QI/w-d-xo.html
      This talk uses modern CMake functions, also all the code is available at github as a tutorial.

    • @code-dredd
      @code-dredd 5 ปีที่แล้ว +10

      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 ปีที่แล้ว +2

      @@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?

  • @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

  • @kyonas6047
    @kyonas6047 2 ปีที่แล้ว

    i love u so much im trying to add moding support and lua is the best choice cuz games like roblox use it for moding

  • @user-bf1zg6tx6u
    @user-bf1zg6tx6u 4 ปีที่แล้ว

    0:33 It's also very useful for businesses and industry to be able to modify their programs vapidly

  • @justsomedude5108
    @justsomedude5108 5 ปีที่แล้ว +1

    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 ปีที่แล้ว +2

      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

  • @Ben-up4lj
    @Ben-up4lj 5 ปีที่แล้ว +3

    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 ปีที่แล้ว +7

      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.

  • @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.

  • @slaincow4032
    @slaincow4032 5 ปีที่แล้ว +1

    Woah LUA

    • @javidx9
      @javidx9  5 ปีที่แล้ว

      Still some C++ in there as well XD

  • @justgame5508
    @justgame5508 5 ปีที่แล้ว +2

    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

  • @Sparkette
    @Sparkette 3 ปีที่แล้ว

    Is lua_close really necessary if you're only doing it right before the program quits? Wouldn't the OS free everything when the program exits?

  • @zxcghoul1275
    @zxcghoul1275 3 ปีที่แล้ว

    interesting language in terms of automating tasks and speeding up them.