File tree Expand file tree Collapse file tree 5 files changed +128
-0
lines changed
Expand file tree Collapse file tree 5 files changed +128
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
3+ * This program is free software licensed under GPL version 3
4+ * Please see the included DOCS/LICENSE.md for more information
5+ */
6+
7+ // This file is used for custom Lua methods, without needing to edit the existing method header files.
8+ // This can also be used to override default methods without needing to edit existing methods.
9+ // It follows the same structure as any other method header, except you can use RegisterCustomFunction
10+ // to register multiple method tables in a single file.
11+
12+ #include " ElunaTemplate.h"
13+ #include " ElunaIncludes.h"
14+
15+ #ifndef CUSTOMMETHODS_H
16+ #define CUSTOMMETHODS_H
17+
18+ namespace LuaCustom
19+ {
20+ // See the CustomMethods header file in the TC method directory for an example.
21+ inline void RegisterCustomFunctions (Eluna* E)
22+ {
23+
24+ };
25+ };
26+
27+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
3+ * This program is free software licensed under GPL version 3
4+ * Please see the included DOCS/LICENSE.md for more information
5+ */
6+
7+ // This file is used for custom Lua methods, without needing to edit the existing method header files.
8+ // This can also be used to override default methods without needing to edit existing methods.
9+ // It follows the same structure as any other method header, except you can use RegisterCustomFunction
10+ // to register multiple method tables in a single file.
11+
12+ #include " ElunaTemplate.h"
13+ #include " ElunaIncludes.h"
14+
15+ #ifndef CUSTOMMETHODS_H
16+ #define CUSTOMMETHODS_H
17+
18+ namespace LuaCustom
19+ {
20+ // See the CustomMethods header file in the TC method directory for an example.
21+ inline void RegisterCustomFunctions (Eluna* E)
22+ {
23+
24+ };
25+ };
26+
27+ #endif
Original file line number Diff line number Diff line change 3232#include " VehicleMethods.h"
3333#include " BattleGroundMethods.h"
3434
35+ // Custom methods
36+ #include " CustomMethods.h"
37+
3538void RegisterMethods (Eluna* E)
3639{
3740 ElunaTemplate<>::SetMethods (E, LuaGlobalFunctions::GlobalMethods);
@@ -112,5 +115,8 @@ void RegisterMethods(Eluna* E)
112115
113116 ElunaTemplate<ObjectGuid>::Register (E, " ObjectGuid" );
114117
118+ // Register custom functions
119+ LuaCustom::RegisterCustomFunctions (E);
120+
115121 LuaVal::Register (E->L );
116122}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
3+ * This program is free software licensed under GPL version 3
4+ * Please see the included DOCS/LICENSE.md for more information
5+ */
6+
7+ // This file is used for custom Lua methods, without needing to edit the existing method header files.
8+ // This can also be used to override default methods without needing to edit existing methods.
9+ // It follows the same structure as any other method header, except you can use RegisterCustomFunction
10+ // to register multiple method tables in a single file.
11+
12+ #include " ElunaTemplate.h"
13+ #include " ElunaIncludes.h"
14+
15+ #ifndef CUSTOMMETHODS_H
16+ #define CUSTOMMETHODS_H
17+
18+ namespace LuaCustom
19+ {
20+ // Define a custom method that returns the players name
21+ int CustomPlayerMethod (Eluna* E, Player* player)
22+ {
23+ E->Push (player->GetName ());
24+ return 1 ;
25+ }
26+
27+ // Create a custom player method registry
28+ ElunaRegister<Player> CustomPlayerMethods[] =
29+ {
30+ // Add the custom player method to the registry
31+ { " CustomPlayerMethod" , &LuaCustom::CustomPlayerMethod },
32+ };
33+
34+ inline void RegisterCustomFunctions (Eluna* E)
35+ {
36+ // Append all the custom Player methods to the Player object
37+ ElunaTemplate<Player>::SetMethods (E, CustomPlayerMethods);
38+ };
39+ };
40+
41+ #endif
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
3+ * This program is free software licensed under GPL version 3
4+ * Please see the included DOCS/LICENSE.md for more information
5+ */
6+
7+ // This file is used for custom Lua methods, without needing to edit the existing method header files.
8+ // This can also be used to override default methods without needing to edit existing methods.
9+ // It follows the same structure as any other method header, except you can use RegisterCustomFunction
10+ // to register multiple method tables in a single file.
11+
12+ #include " ElunaTemplate.h"
13+ #include " ElunaIncludes.h"
14+
15+ #ifndef CUSTOMMETHODS_H
16+ #define CUSTOMMETHODS_H
17+
18+ namespace LuaCustom
19+ {
20+ // See the CustomMethods header file in the TC method directory for an example.
21+ inline void RegisterCustomFunctions (Eluna* E)
22+ {
23+
24+ };
25+ };
26+
27+ #endif
You can’t perform that action at this time.
0 commit comments