Adding Type Safety to Love2D

Поділитися
Вставка
  • Опубліковано 22 січ 2025

КОМЕНТАРІ • 5

  • @vonrain9067
    @vonrain9067 17 днів тому

    This is incredibly informative, and it applies to really anything one does in Lua, not necessarily gamedev, ofc that feels like the main use case of the language based on my minimal experience. I'm actually super impressed with the algorithm for even sending this my way. I've been playing around with Lua and Love2d for the first time quite recently, never used Lua never heard of Love, thank Balatro for bringing some new eyeballs ig

  • @PledgeBass
    @PledgeBass 18 днів тому +2

    Have you used lua language server annotations? They were a complete game changer for me. I still use a lot of asserts and manually check for "types" - But if you use the annotations, even just very minimally, you will catch like 90% of these issues without even running the code, just through inline lsp warnings.
    I still go crazy with asserts, though. But now I end up fixing most issues that would cause them to trigger before I even run my code.

    • @SkyVaultGames
      @SkyVaultGames  18 днів тому +2

      I have! It's amazing what they're able to do with the language server

  •  17 днів тому

    The problem with this solution is that you're creating a metatable for every instance instead of having a proper type system where you set the metatable to some shared type object. It's ok for a few player instances, but when you try to create 10 K bullets, you may break Chrome's record in memory usage :)

    • @SkyVaultGames
      @SkyVaultGames  17 днів тому

      There's definitely a memory cost in how I did it, a better implementation would have a single shared metatable per type tag