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
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.
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 :)
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
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.
I have! It's amazing what they're able to do with the language server
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 :)
There's definitely a memory cost in how I did it, a better implementation would have a single shared metatable per type tag