[DiscordArchive] for what job is lua better than c++ ?
[DiscordArchive] for what job is lua better than c++ ?
Archived author: Rymercyble • Posted: 2022-10-28T09:39:45.881000+00:00
Original source
for what job is lua better than c++ ?
Archived author: Foe • Posted: 2022-10-28T09:43:51.447000+00:00
Original source
It's a scripting language, pretty much everything that can be scripted within reason what you shouldn't do in Lua you can relatively easily offload with c++ and expose as a method. C++ isn't a scripting language, and pretty much no one ever uses the dynamic library reloading feature. It makes it cumbersome to both prototype, test and debug compared to a dedicated scripting language. The use of c++ scripts like we do in emulation is not the industry standard, and absolutely wouldn't fly in the current state for any other project.
Archived author: Foe • Posted: 2022-10-28T09:45:10.106000+00:00
Original source
And in something like wow, you shouldn't really rely on the performance and precision of c++ for most things, it's not a very realistic expectation to have for large scale networked games like MMOs
Archived author: stoneharry • Posted: 2022-10-28T09:46:25.979000+00:00
Original source
Same reason we don't use assembly for everything
Archived author: Foe • Posted: 2022-10-28T09:46:51.930000+00:00
Original source
Anyway, telling people there's no room for a scripting language just because you know a programming language is a bit absurd. Don't tell people to remove tools from their toolbox, that just makes for worse craftsmen
Archived author: Titi • Posted: 2022-10-28T09:47:50.988000+00:00
Original source
Faster developement, easyness and readability. You pretty much only use C++ if you need the performance or precise memory and hardware management
Archived author: Rymercyble • Posted: 2022-10-28T09:49:07.346000+00:00
Original source
i dont think im able to explain what i mean
Archived author: Foe • Posted: 2022-10-28T09:52:10.057000+00:00
Original source
To give you a proper answer, it depends. There's some caveats with using Eluna in dungeons, primarily that the instance hooks overwrite most dungeon scripts. In short, don't mix c++ and Lua in the same dungeon for most things, it causes weird issues. If you strictly script an entire dungeon in Lua, then there's no issue doing so.
Archived author: Titi • Posted: 2022-10-28T09:54:02.620000+00:00
Original source
For emulator scripting specifically, it mostly depends what you're good at, C++ is generally better as it's "native" and the Lua implementation isn't optimal. Though if coding very large custom system I'd say Lua could be worth it for the big dev time save, it depends. Also Eluna/Lua is used for custom client-server communication, not possible with the default framework
Archived author: stoneharry • Posted: 2022-10-28T09:57:01.985000+00:00
Original source
Whether you use Lua, C++, or whatever else - good fundamental knowledge is needed to write good code. For example, you can't just store a pointer to a object since it may be invalidated. Likewise if you cache a value by the instance Id, you need to create a hook for the instance free event to uncache it because instance ids can be reused.