diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 17:41:05 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 17:41:05 +0200 |
commit | 780f069d10b120968ae5867cc7e5a0da1ed05054 (patch) | |
tree | 99dabf0e3759637fbe0134e59a5ec98d8c2ffae9 /src/state.cpp | |
parent | 50f4c40bdb5667aa7053434dede2dd98f6f9e243 (diff) | |
download | lanes-780f069d10b120968ae5867cc7e5a0da1ed05054.tar.gz lanes-780f069d10b120968ae5867cc7e5a0da1ed05054.tar.bz2 lanes-780f069d10b120968ae5867cc7e5a0da1ed05054.zip |
Boyscouting
Diffstat (limited to 'src/state.cpp')
-rw-r--r-- | src/state.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/state.cpp b/src/state.cpp index 267554e..3f6b3d7 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -50,7 +50,7 @@ namespace { | |||
50 | // ############################################################################################# | 50 | // ############################################################################################# |
51 | // ############################################################################################# | 51 | // ############################################################################################# |
52 | 52 | ||
53 | [[nodiscard]] static int require_lanes_core(lua_State* L_) | 53 | [[nodiscard]] static int require_lanes_core(lua_State* const L_) |
54 | { | 54 | { |
55 | // leaves a copy of 'lanes.core' module table on the stack | 55 | // leaves a copy of 'lanes.core' module table on the stack |
56 | luaL_requiref(L_, kLanesCoreLibName, luaopen_lanes_core, 0); | 56 | luaL_requiref(L_, kLanesCoreLibName, luaopen_lanes_core, 0); |
@@ -95,7 +95,7 @@ namespace { | |||
95 | 95 | ||
96 | // ############################################################################################# | 96 | // ############################################################################################# |
97 | 97 | ||
98 | static void Open1Lib(lua_State* L_, std::string_view const& name_) | 98 | static void Open1Lib(lua_State* const L_, std::string_view const& name_) |
99 | { | 99 | { |
100 | for (luaL_Reg const& _entry : local::sLibs) { | 100 | for (luaL_Reg const& _entry : local::sLibs) { |
101 | if (name_ == _entry.name) { | 101 | if (name_ == _entry.name) { |
@@ -123,7 +123,7 @@ namespace { | |||
123 | // ############################################################################################# | 123 | // ############################################################################################# |
124 | 124 | ||
125 | // just like lua_xmove, args are (from, to) | 125 | // just like lua_xmove, args are (from, to) |
126 | static void CopyOneTimeSettings(Universe* U_, SourceState L1_, DestState L2_) | 126 | static void CopyOneTimeSettings(Universe* const U_, SourceState const L1_, DestState const L2_) |
127 | { | 127 | { |
128 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ U_ }); | 128 | DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ U_ }); |
129 | 129 | ||
@@ -157,7 +157,7 @@ namespace state { | |||
157 | // ############################################################################################# | 157 | // ############################################################################################# |
158 | // ############################################################################################# | 158 | // ############################################################################################# |
159 | 159 | ||
160 | void CallOnStateCreate(Universe* U_, lua_State* L_, lua_State* from_, LookupMode mode_) | 160 | void CallOnStateCreate(Universe* const U_, lua_State* const L_, lua_State* const from_, LookupMode const mode_) |
161 | { | 161 | { |
162 | if (U_->onStateCreateFunc == nullptr) { | 162 | if (U_->onStateCreateFunc == nullptr) { |
163 | return; | 163 | return; |
@@ -195,7 +195,7 @@ namespace state { | |||
195 | 195 | ||
196 | // ############################################################################################# | 196 | // ############################################################################################# |
197 | 197 | ||
198 | lua_State* CreateState([[maybe_unused]] Universe* U_, lua_State* from_) | 198 | lua_State* CreateState([[maybe_unused]] Universe* const U_, lua_State* const from_) |
199 | { | 199 | { |
200 | lua_State* const _L { | 200 | lua_State* const _L { |
201 | std::invoke( | 201 | std::invoke( |
@@ -228,7 +228,7 @@ namespace state { | |||
228 | 228 | ||
229 | // ############################################################################################# | 229 | // ############################################################################################# |
230 | 230 | ||
231 | void InitializeOnStateCreate(Universe* U_, lua_State* L_) | 231 | void InitializeOnStateCreate(Universe* const U_, lua_State* const L_) |
232 | { | 232 | { |
233 | STACK_CHECK_START_REL(L_, 1); // L_: settings | 233 | STACK_CHECK_START_REL(L_, 1); // L_: settings |
234 | if (luaG_getfield(L_, -1, kOnStateCreate) != LuaType::NIL) { // L_: settings on_state_create|nil | 234 | if (luaG_getfield(L_, -1, kOnStateCreate) != LuaType::NIL) { // L_: settings on_state_create|nil |
@@ -266,7 +266,7 @@ namespace state { | |||
266 | * Base ("unpack", "print" etc.) is always added, unless 'libs' is nullptr. | 266 | * Base ("unpack", "print" etc.) is always added, unless 'libs' is nullptr. |
267 | * | 267 | * |
268 | */ | 268 | */ |
269 | lua_State* NewLaneState(Universe* U_, SourceState from_, std::optional<std::string_view> const& libs_) | 269 | lua_State* NewLaneState(Universe* const U_, SourceState const from_, std::optional<std::string_view> const& libs_) |
270 | { | 270 | { |
271 | DestState const _L{ CreateState(U_, from_) }; | 271 | DestState const _L{ CreateState(U_, from_) }; |
272 | 272 | ||