View Full Version : Lua scripts codestyle (Eluna scripts repo)

04-13-2014, 11:56 AM
Hi, I was looking for something to do and came across this (https://github.com/ElunaLuaEngine/Scripts), I thought i'd continue the blizzlike scriptings and in the same time learn Lua and see how far I can code without getting bored of it. Anyway my questions are : Is there any codestyle regarding the repo I should follow ? Should I create more folders ( like trinitycore (e.g : EasternKingdoms/AlteracValley, EasternKingdoms/MoltenCore etc...one folder per instance basicly)).

I think that's pretty much it, thanks in advance.

04-13-2014, 12:02 PM
Yup, do it the same way as on the repo, also have a proper description for the name of the script. The way they're done right now they're named the same as trinity's scripts and converted accordingly.

04-13-2014, 03:00 PM
We discussed a little now and there are a few basic rules at the moment that have come up:
Registers should be at the bottom.
You should use a table for example to localize the functions and variables for an AI scirpt, quest script etc. (think of it as a script "class" for the AI), for example see this: https://github.com/ElunaLuaEngine/Scripts/blob/master/Blizzlike/EasternKingdoms/boss_kruul.lua
Fast example in case link broken: local BossName = {}; function BossName.SomeFunc() print("test"); end;
The function names should describe when they are triggered or what they do. For example "OnEnterCombat", "Frostbolt".

If you have any questions about something just ask :3