From 452f24128791a27511fcebbff8fdecc4f3151d49 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 24 Jun 2024 11:15:50 +0200 Subject: Fix wrong Linda name when not giving any --- docs/index.html | 12 +++++++++++- src/keeper.cpp | 10 ++++++++++ src/lindafactory.cpp | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 6e2b4ed..db9ec5a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1329,7 +1329,17 @@

-	[table] = linda_h:dump()
+	linda_h:dump() ->
+	{
+		[<key>] =
+		{
+			first = <n>
+			count = <n>
+			limit = <n>|'unlimited'
+			fifo = { <array of values> }
+		}
+		...
+	} 
 

diff --git a/src/keeper.cpp b/src/keeper.cpp index cdbfac9..8261f5a 100644 --- a/src/keeper.cpp +++ b/src/keeper.cpp @@ -656,6 +656,16 @@ void Keeper::operator delete[](void* p_, Universe* U_) // ################################################################################################# // only used by linda:dump() and linda:__towatch() for debugging purposes +// table is populated as follows: +// { +// [] = { +// first = , +// count = , +// limit = | 'unlimited', +// fifo = { } +// } +// ... +// } int Keeper::PushLindaStorage(Linda& linda_, DestState const L_) { Keeper* const _keeper{ linda_.whichKeeper() }; diff --git a/src/lindafactory.cpp b/src/lindafactory.cpp index d5ebc9b..771a4c3 100644 --- a/src/lindafactory.cpp +++ b/src/lindafactory.cpp @@ -105,7 +105,7 @@ std::string_view LindaFactory::moduleName() const DeepPrelude* LindaFactory::newDeepObjectInternal(lua_State* const L_) const { // we always expect name and group at the bottom of the stack (either can be nil). any extra stuff we ignore and keep unmodified - std::string_view _linda_name{ luaG_tostring(L_, 1) }; + std::string_view _linda_name{ lua_isnil(L_, 1) ? "" : luaG_tostring(L_, 1) }; LindaGroup _linda_group{ static_cast(lua_tointeger(L_, 2)) }; // store in the linda the location of the script that created it -- cgit v1.2.3-55-g6feb