Creating a log including variabename and tablename

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i want to create a message that gets send to a log storage with the name of the variable and the value

  2. What is the issue? Include screenshots/videos if possible!
    I can get the value, but not the name

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    try 1:print(…)

try 2:…name – added a point trying to get the name)

try 3: …parent

try 4: for i,v in pairs (…) do
print v.name
end

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

--logs 
function log(player, ...)
	local this = {...}
	total = tostring(player) .. " :"
	for i,v in pairs(this) do
			tablesplitter(v)
	end
	print(total) -- send to storage
end

function tablesplitter(tab)
	if typeof(tab) == "table" then
		total = total .. " table{" -- id like to replace this part to add the table name
		for _,v in pairs(tab) do
			tablesplitter(v)
		end
		total = total .. " }"
	else
    -- add name of the value here
		total = total .. " " .. tostring(tab) 
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Could just be done with table.concat().
However, you have to write the variable/table as a string, Lua won’t grab your variable names.