aboutsummaryrefslogtreecommitdiff
path: root/src/lindafactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lindafactory.cpp')
-rw-r--r--src/lindafactory.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lindafactory.cpp b/src/lindafactory.cpp
index 4eab0c1..483037f 100644
--- a/src/lindafactory.cpp
+++ b/src/lindafactory.cpp
@@ -47,22 +47,22 @@ void LindaFactory::createMetatable(lua_State* L_) const
47 lua_newtable(L_); // L_: mt 47 lua_newtable(L_); // L_: mt
48 48
49 // protect metatable from external access 49 // protect metatable from external access
50 luaG_pushstring(L_, kLindaMetatableName); // L_: mt "<name>" 50 luaW_pushstring(L_, kLindaMetatableName); // L_: mt "<name>"
51 lua_setfield(L_, -2, "__metatable"); // L_: mt 51 lua_setfield(L_, -2, "__metatable"); // L_: mt
52 52
53 // the linda functions 53 // the linda functions
54 luaG_registerlibfuncs(L_, mLindaMT); 54 luaW_registerlibfuncs(L_, mLindaMT);
55 55
56 kNilSentinel.pushKey(L_); // L_: mt kNilSentinel 56 kNilSentinel.pushKey(L_); // L_: mt kNilSentinel
57 lua_setfield(L_, -2, "null"); // L_: mt 57 lua_setfield(L_, -2, "null"); // L_: mt
58 58
59 // if the metatable contains __index, leave it as is 59 // if the metatable contains __index, leave it as is
60 if (luaG_getfield(L_, kIdxTop, kIndex) != LuaType::NIL) { // L_: mt __index 60 if (luaW_getfield(L_, kIdxTop, kIndex) != LuaType::NIL) { // L_: mt __index
61 lua_pop(L_, 1); // L_: mt __index 61 lua_pop(L_, 1); // L_: mt __index
62 } else { 62 } else {
63 // metatable is its own index 63 // metatable is its own index
64 lua_pushvalue(L_, kIdxTop); // L_: mt mt 64 lua_pushvalue(L_, kIdxTop); // L_: mt mt
65 luaG_setfield(L_, StackIndex{ -2 }, kIndex); // L_: mt 65 luaW_setfield(L_, StackIndex{ -2 }, kIndex); // L_: mt
66 } 66 }
67 67
68 STACK_CHECK(L_, 1); 68 STACK_CHECK(L_, 1);
@@ -110,7 +110,7 @@ DeepPrelude* LindaFactory::newDeepObjectInternal(lua_State* const L_) const
110{ 110{
111 STACK_CHECK_START_REL(L_, 0); 111 STACK_CHECK_START_REL(L_, 0);
112 // we always expect name, wake_period, group at the bottom of the stack (either can be nil). any extra stuff we ignore and keep unmodified 112 // we always expect name, wake_period, group at the bottom of the stack (either can be nil). any extra stuff we ignore and keep unmodified
113 std::string_view _linda_name{ luaG_tostring(L_, StackIndex{ 1 }) }; 113 std::string_view _linda_name{ luaW_tostring(L_, StackIndex{ 1 }) };
114 auto const _wake_period{ static_cast<lua_Duration>(lua_tonumber(L_, 2)) }; 114 auto const _wake_period{ static_cast<lua_Duration>(lua_tonumber(L_, 2)) };
115 LindaGroup const _linda_group{ static_cast<int>(lua_tointeger(L_, 3)) }; 115 LindaGroup const _linda_group{ static_cast<int>(lua_tointeger(L_, 3)) };
116 116
@@ -119,12 +119,12 @@ DeepPrelude* LindaFactory::newDeepObjectInternal(lua_State* const L_) const
119 lua_Debug _ar; 119 lua_Debug _ar;
120 if (lua_getstack(L_, 1, &_ar) == 1) { // 1 because we want the name of the function that called lanes.linda (where we currently are) 120 if (lua_getstack(L_, 1, &_ar) == 1) { // 1 because we want the name of the function that called lanes.linda (where we currently are)
121 lua_getinfo(L_, "Sln", &_ar); 121 lua_getinfo(L_, "Sln", &_ar);
122 _linda_name = luaG_pushstring(L_, "%s:%d", _ar.short_src, _ar.currentline); 122 _linda_name = luaW_pushstring(L_, "%s:%d", _ar.short_src, _ar.currentline);
123 } else { 123 } else {
124 _linda_name = luaG_pushstring(L_, "<unresolved>"); 124 _linda_name = luaW_pushstring(L_, "<unresolved>");
125 } 125 }
126 // since the name is not empty, it is at slot 1, and we can replace "auto" with the result, just in case 126 // since the name is not empty, it is at slot 1, and we can replace "auto" with the result, just in case
127 LUA_ASSERT(L_, luaG_tostring(L_, StackIndex{ 1 }) == "auto"); 127 LUA_ASSERT(L_, luaW_tostring(L_, StackIndex{ 1 }) == "auto");
128 lua_replace(L_, 1); 128 lua_replace(L_, 1);
129 } 129 }
130 130