diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 16:01:26 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-14 16:01:26 +0200 |
commit | 4d364d3e77667b70bf3261da004f4990ef0c3ada (patch) | |
tree | 5a106ca427ba8704635b3324a352475dd8706ab8 /src/nameof.cpp | |
parent | a925a9ee21c10184a08625e83d2b55850d6cb32f (diff) | |
download | lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.tar.gz lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.tar.bz2 lanes-4d364d3e77667b70bf3261da004f4990ef0c3ada.zip |
lua_pushliteral -> luaG_pushstring
Diffstat (limited to 'src/nameof.cpp')
-rw-r--r-- | src/nameof.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nameof.cpp b/src/nameof.cpp index 543c3d4..a33c2e5 100644 --- a/src/nameof.cpp +++ b/src/nameof.cpp | |||
@@ -91,7 +91,7 @@ THE SOFTWARE. | |||
91 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k {} {mt} | 91 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k {} {mt} |
92 | if (lua_istable(L_, -1)) { | 92 | if (lua_istable(L_, -1)) { |
93 | ++depth_; | 93 | ++depth_; |
94 | lua_pushliteral(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k {} {mt} "__metatable" | 94 | luaG_pushstring(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k {} {mt} "__metatable" |
95 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} | 95 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} |
96 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); | 96 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); |
97 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} nil | 97 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k {} {mt} nil |
@@ -113,7 +113,7 @@ THE SOFTWARE. | |||
113 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k U {mt} | 113 | if (lua_getmetatable(L_, -1)) { // L_: o "r" {c} {fqn} ... {?} k U {mt} |
114 | if (lua_istable(L_, -1)) { | 114 | if (lua_istable(L_, -1)) { |
115 | ++depth_; | 115 | ++depth_; |
116 | lua_pushliteral(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k U {mt} "__metatable" | 116 | luaG_pushstring(L_, "__metatable"); // L_: o "r" {c} {fqn} ... {?} k U {mt} "__metatable" |
117 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k U {mt} | 117 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k U {mt} |
118 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); | 118 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); |
119 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k U {mt} nil | 119 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k U {mt} nil |
@@ -129,7 +129,7 @@ THE SOFTWARE. | |||
129 | while (lua_getiuservalue(L_, -1, _uvi) != LUA_TNONE) { // L_: o "r" {c} {fqn} ... {?} k U {u} | 129 | while (lua_getiuservalue(L_, -1, _uvi) != LUA_TNONE) { // L_: o "r" {c} {fqn} ... {?} k U {u} |
130 | if (lua_istable(L_, -1)) { // if it is a table, look inside | 130 | if (lua_istable(L_, -1)) { // if it is a table, look inside |
131 | ++depth_; | 131 | ++depth_; |
132 | lua_pushliteral(L_, "uservalue"); // L_: o "r" {c} {fqn} ... {?} k v {u} "uservalue" | 132 | luaG_pushstring(L_, "uservalue"); // L_: o "r" {c} {fqn} ... {?} k v {u} "uservalue" |
133 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k v {u} | 133 | lua_rawseti(L_, kFQN, depth_); // L_: o "r" {c} {fqn} ... {?} k v {u} |
134 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); | 134 | shortest_ = DiscoverObjectNameRecur(L_, shortest_, depth_); |
135 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k v {u} nil | 135 | lua_pushnil(L_); // L_: o "r" {c} {fqn} ... {?} k v {u} nil |
@@ -188,14 +188,14 @@ LUAG_FUNC(nameof) | |||
188 | // push a table whose contents are strings that, when concatenated, produce unique name | 188 | // push a table whose contents are strings that, when concatenated, produce unique name |
189 | lua_newtable(L_); // L_: o nil {c} {fqn} | 189 | lua_newtable(L_); // L_: o nil {c} {fqn} |
190 | // {fqn}[1] = "_G" | 190 | // {fqn}[1] = "_G" |
191 | lua_pushliteral(L_, LUA_GNAME); // L_: o nil {c} {fqn} "_G" | 191 | luaG_pushstring(L_, LUA_GNAME); // L_: o nil {c} {fqn} "_G" |
192 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} | 192 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} |
193 | // this is where we start the search | 193 | // this is where we start the search |
194 | luaG_pushglobaltable(L_); // L_: o nil {c} {fqn} _G | 194 | luaG_pushglobaltable(L_); // L_: o nil {c} {fqn} _G |
195 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); | 195 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); |
196 | if (lua_isnil(L_, 2)) { // try again with registry, just in case... | 196 | if (lua_isnil(L_, 2)) { // try again with registry, just in case... |
197 | lua_pop(L_, 1); // L_: o nil {c} {fqn} | 197 | lua_pop(L_, 1); // L_: o nil {c} {fqn} |
198 | lua_pushliteral(L_, "_R"); // L_: o nil {c} {fqn} "_R" | 198 | luaG_pushstring(L_, "_R"); // L_: o nil {c} {fqn} "_R" |
199 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} | 199 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} |
200 | lua_pushvalue(L_, LUA_REGISTRYINDEX); // L_: o nil {c} {fqn} _R | 200 | lua_pushvalue(L_, LUA_REGISTRYINDEX); // L_: o nil {c} {fqn} _R |
201 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); | 201 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); |