I skim read this thread and there are good arguments either way. Personally I used Lua within ArcEmu, and this is what I found.
Creating a dungeon was super quick and easy due to everything being loosely typed and being able to prototype in real time. I know you can use ‘auto x = std::listboost::any{ y, 1, 5, { 1, 2, 3 }, {{3, 2}, {1}}, nullptr, “hello” };’ with modern C++ but I was still more comfortable with the simple syntax of Lua.
Here is an example dungeon with my code style: https://github.com/stoneharry/Misc-WoW-Stuff/blob/master/Scripts/Instances/CoT-TheHunt.lua
I don’t know if there is a better structure but it is the way I implemented it working with the ArcEmu API.
This was just incredibly quick to put together and have working. In C++ if I changed a header file, suddenly the entire project needed to be recompiled which takes > 2mins for TrinityCore (way less on ArcEmu) on my Intel I7-4770 CPU. How often does one need to do that? Quite a lot it turns out when I am designing and implementing. Furthermore I could just link Dropbox to my server and develop entirely on localhost, saving a script and going in game to have the updated script already reloaded and ready to test.
To sum it up, from my experience:
Advantages:
[ul][li]Incredibly fast to develop with, much faster than C++[/li][li]Easy and loose syntax and types[/li][/ul]
Disadvantages:
[ul][li]Slower processing speed (negligible? Is this even a factor on modern hardware? WoW never seems to use many resources, especially compared to other game servers with the same number of players. Also JIT compilation)[/li][li]Attracts bad code (ArcEmu still has horrendous code marked as ‘stable’ under their Git repository and even on their SVN repository despite this being pointed out. Some of it doesn’t even run and I don’t think was even tested. And I’m sure we all remember the scripts being released back in TBC era.)[/li][/ul]
I think the main issue is would anyone even take advantage of a Lua engine? The only people who I imagine could code well in Lua are those well versed in programming anyway, in which case would they use it over C++ if they are used to the C++ way now?
Also it would fragment code in that some content would be done in Lua and some content would be done in C++. This is not ideal at all - it gets confusing fast and scripts may conflict.
One could just refuse all community content in the form of Lua until reviewed by somebody, and refuse all support for coding with Lua. But this then becomes something that needs to be managed and code styles need to be addressed.
I am not really in favour of having a Lua engine unless quality is maintained somehow. At the same time, we don’t want elitist and overcomplicated guidelines to scare off those who can program but are not familiar with certain terminology.
Also I hate the idea of wait(x). That’s what event based programming is for - raise an event that recalls the function or a new one in a set time, reuse functions by marking variables of what event should be handled.
Food for thought, I guess. Just trying to raise some more discussions than the current ones going in circles.