aboutsummaryrefslogtreecommitdiff
path: root/src/cancel.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-07-04 13:50:53 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2025-07-04 13:50:53 +0200
commit042055968ab0c48faec607889814e38c50c09efa (patch)
tree4ec067a03ffcb720d8bf38968d5f84ccec8230d0 /src/cancel.cpp
parent963afcbb3d9dac47b84552ed11e53a0641ad924d (diff)
downloadlanes-042055968ab0c48faec607889814e38c50c09efa.tar.gz
lanes-042055968ab0c48faec607889814e38c50c09efa.tar.bz2
lanes-042055968ab0c48faec607889814e38c50c09efa.zip
Changed lua wrapper prefixes from luaG_ to luaW_ (w as in wrapper!)
Diffstat (limited to 'src/cancel.cpp')
-rw-r--r--src/cancel.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cancel.cpp b/src/cancel.cpp
index 2d8029e..6812b0d 100644
--- a/src/cancel.cpp
+++ b/src/cancel.cpp
@@ -70,8 +70,8 @@ namespace {
70 [[nodiscard]] 70 [[nodiscard]]
71 static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_) 71 static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_)
72 { 72 {
73 if (luaG_type(L_, idx_) == LuaType::STRING) { 73 if (luaW_type(L_, idx_) == LuaType::STRING) {
74 std::string_view const _str{ luaG_tostring(L_, idx_) }; 74 std::string_view const _str{ luaW_tostring(L_, idx_) };
75 auto const _op{ WhichCancelOp(_str) }; 75 auto const _op{ WhichCancelOp(_str) };
76 lua_remove(L_, idx_); // argument is processed, remove it 76 lua_remove(L_, idx_); // argument is processed, remove it
77 if (!_op.has_value()) { 77 if (!_op.has_value()) {
@@ -123,7 +123,7 @@ LUAG_FUNC(cancel_test)
123 if (_test == CancelRequest::None) { 123 if (_test == CancelRequest::None) {
124 lua_pushboolean(L_, 0); 124 lua_pushboolean(L_, 0);
125 } else { 125 } else {
126 luaG_pushstring(L_, (_test == CancelRequest::Soft) ? "soft" : "hard"); 126 luaW_pushstring(L_, (_test == CancelRequest::Soft) ? "soft" : "hard");
127 } 127 }
128 return 1; 128 return 1;
129} 129}
@@ -158,7 +158,7 @@ LUAG_FUNC(lane_cancel)
158 // the caller shouldn't have provided a hook count in that case 158 // the caller shouldn't have provided a hook count in that case
159 return 0; 159 return 0;
160 } 160 }
161 if (luaG_type(L_, StackIndex{ 2 }) != LuaType::NUMBER) { 161 if (luaW_type(L_, StackIndex{ 2 }) != LuaType::NUMBER) {
162 raise_luaL_error(L_, "Hook count expected"); 162 raise_luaL_error(L_, "Hook count expected");
163 } 163 }
164 auto const _hook_count{ static_cast<int>(lua_tointeger(L_, 2)) }; 164 auto const _hook_count{ static_cast<int>(lua_tointeger(L_, 2)) };
@@ -170,7 +170,7 @@ LUAG_FUNC(lane_cancel)
170 }) }; 170 }) };
171 171
172 std::chrono::time_point<std::chrono::steady_clock> _until{ std::chrono::time_point<std::chrono::steady_clock>::max() }; 172 std::chrono::time_point<std::chrono::steady_clock> _until{ std::chrono::time_point<std::chrono::steady_clock>::max() };
173 if (luaG_type(L_, StackIndex{ 2 }) == LuaType::NUMBER) { // we don't want to use lua_isnumber() because of autocoercion 173 if (luaW_type(L_, StackIndex{ 2 }) == LuaType::NUMBER) { // we don't want to use lua_isnumber() because of autocoercion
174 lua_Duration const duration{ lua_tonumber(L_, 2) }; 174 lua_Duration const duration{ lua_tonumber(L_, 2) };
175 if (duration.count() >= 0.0) { 175 if (duration.count() >= 0.0) {
176 _until = std::chrono::steady_clock::now() + std::chrono::duration_cast<std::chrono::steady_clock::duration>(duration); 176 _until = std::chrono::steady_clock::now() + std::chrono::duration_cast<std::chrono::steady_clock::duration>(duration);
@@ -186,7 +186,7 @@ LUAG_FUNC(lane_cancel)
186 WakeLane _wake_lane{ (_op.mode == CancelRequest::Hard) ? WakeLane::Yes : WakeLane::No }; 186 WakeLane _wake_lane{ (_op.mode == CancelRequest::Hard) ? WakeLane::Yes : WakeLane::No };
187 if (lua_gettop(L_) >= 2) { 187 if (lua_gettop(L_) >= 2) {
188 if (!lua_isboolean(L_, 2)) { 188 if (!lua_isboolean(L_, 2)) {
189 raise_luaL_error(L_, "Boolean expected for wake_lane argument, got %s", luaG_typename(L_, StackIndex{ 2 }).data()); 189 raise_luaL_error(L_, "Boolean expected for wake_lane argument, got %s", luaW_typename(L_, StackIndex{ 2 }).data());
190 } 190 }
191 _wake_lane = lua_toboolean(L_, 2) ? WakeLane::Yes : WakeLane::No; 191 _wake_lane = lua_toboolean(L_, 2) ? WakeLane::Yes : WakeLane::No;
192 lua_remove(L_, 2); // argument is processed, remove it // L_: lane 192 lua_remove(L_, 2); // argument is processed, remove it // L_: lane
@@ -206,7 +206,7 @@ LUAG_FUNC(lane_cancel)
206 206
207 case CancelResult::Timeout: 207 case CancelResult::Timeout:
208 lua_pushboolean(L_, 0); // L_: false 208 lua_pushboolean(L_, 0); // L_: false
209 luaG_pushstring(L_, "timeout"); // L_: false "timeout" 209 luaW_pushstring(L_, "timeout"); // L_: false "timeout"
210 break; 210 break;
211 211
212 case CancelResult::Cancelled: 212 case CancelResult::Cancelled: