diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-07 11:46:25 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-07 11:46:25 +0200 |
commit | ee32d4281a5e59ce81d7f38f86a49fa8ff64d2c3 (patch) | |
tree | 68c0d74ac40c6ee098abf606e3d660a862acf04f /src/linda.cpp | |
parent | 35d7a6bb691d7e0564cda324b3d724caf4901545 (diff) | |
download | lanes-ee32d4281a5e59ce81d7f38f86a49fa8ff64d2c3.tar.gz lanes-ee32d4281a5e59ce81d7f38f86a49fa8ff64d2c3.tar.bz2 lanes-ee32d4281a5e59ce81d7f38f86a49fa8ff64d2c3.zip |
Boyscouting some luaG_ functions
Diffstat (limited to 'src/linda.cpp')
-rw-r--r-- | src/linda.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/linda.cpp b/src/linda.cpp index 031eea0..e4ae3f4 100644 --- a/src/linda.cpp +++ b/src/linda.cpp | |||
@@ -81,13 +81,13 @@ template <bool OPT> | |||
81 | { | 81 | { |
82 | Linda* const _linda{ ToLinda<OPT>(L_, idx_) }; | 82 | Linda* const _linda{ ToLinda<OPT>(L_, idx_) }; |
83 | if (_linda != nullptr) { | 83 | if (_linda != nullptr) { |
84 | std::ignore = luaG_pushstringview(L_, "Linda: "); | 84 | std::ignore = luaG_pushstring(L_, "Linda: "); |
85 | std::string_view const _lindaName{ _linda->getName() }; | 85 | std::string_view const _lindaName{ _linda->getName() }; |
86 | if (!_lindaName.empty()) { | 86 | if (!_lindaName.empty()) { |
87 | std::ignore = luaG_pushstringview(L_, _lindaName); | 87 | std::ignore = luaG_pushstring(L_, _lindaName); |
88 | } else { | 88 | } else { |
89 | // obfuscate the pointer so that we can't read the value with our eyes out of a script | 89 | // obfuscate the pointer so that we can't read the value with our eyes out of a script |
90 | std::ignore = luaG_pushstringview(L_, "%p", std::bit_cast<uintptr_t>(_linda) ^ kConfigRegKey.storage); | 90 | std::ignore = luaG_pushstring(L_, "%p", std::bit_cast<uintptr_t>(_linda) ^ kConfigRegKey.storage); |
91 | } | 91 | } |
92 | lua_concat(L_, 2); | 92 | lua_concat(L_, 2); |
93 | return 1; | 93 | return 1; |
@@ -252,7 +252,7 @@ void Linda::setName(std::string_view const& name_) | |||
252 | LUAG_FUNC(linda_cancel) | 252 | LUAG_FUNC(linda_cancel) |
253 | { | 253 | { |
254 | Linda* const _linda{ ToLinda<false>(L_, 1) }; | 254 | Linda* const _linda{ ToLinda<false>(L_, 1) }; |
255 | std::string_view const _who{ luaG_optstringview(L_, 2, "both") }; | 255 | std::string_view const _who{ luaG_optstring(L_, 2, "both") }; |
256 | // make sure we got 2 arguments: the linda and the cancellation mode | 256 | // make sure we got 2 arguments: the linda and the cancellation mode |
257 | luaL_argcheck(L_, lua_gettop(L_) <= 2, 2, "wrong number of arguments"); | 257 | luaL_argcheck(L_, lua_gettop(L_) <= 2, 2, "wrong number of arguments"); |
258 | 258 | ||
@@ -564,7 +564,7 @@ LUAG_FUNC(linda_receive) | |||
564 | if (_nbPushed == 0) { | 564 | if (_nbPushed == 0) { |
565 | // not enough data in the linda slot to fulfill the request, return nil, "timeout" | 565 | // not enough data in the linda slot to fulfill the request, return nil, "timeout" |
566 | lua_pushnil(L_); | 566 | lua_pushnil(L_); |
567 | std::ignore = luaG_pushstringview(L_, "timeout"); | 567 | std::ignore = luaG_pushstring(L_, "timeout"); |
568 | return 2; | 568 | return 2; |
569 | } | 569 | } |
570 | return _nbPushed; | 570 | return _nbPushed; |