mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
refactor(lua): take integer enum and constants entries as arrays
RegisterIntegerEnum and RegisterConstants took their entries with a count beside them, written as sizeof(t) / sizeof(t[0]), std::size, or a literal. They now take Game::ArrayRef<EnumIntegerEntry>, as RegisterFrameMethods does, so the count comes from the array's type. The documentation recorders RecordEnum and RecordConstants take the same view. All 34 call sites pass only the array. The six literal counts were checked against their arrays first: each was the full length, so every Enum.* and Constants.* table gets the same entries as before. Five files that included <iterator> only for std::size drop it.
This commit is contained in:
@@ -30,8 +30,7 @@ const Game::Lua::EnumIntegerEntry kEntries[] = {
|
||||
};
|
||||
|
||||
void RegisterLuaFunctions() {
|
||||
Game::Lua::RegisterIntegerEnum("Enum", "InputContext", kEntries,
|
||||
sizeof(kEntries) / sizeof(kEntries[0]), "InputConstants");
|
||||
Game::Lua::RegisterIntegerEnum("Enum", "InputContext", kEntries, "InputConstants");
|
||||
}
|
||||
|
||||
const Game::ModuleAutoRegister _autoreg{&RegisterLuaFunctions};
|
||||
|
||||
Reference in New Issue
Block a user