I was just messing around and decided to create a function that prints the contents of a table, here is the code.

function table.print(tbl)
	for k, v in pairs(tbl) do
		print(tostring(v))
	end
end

local lol = {"happy","sad"}

table.print(lol)

ERROR: Attempt to modify a readonly table

3 comments

0

I could be wrong but...Get rid of the dot on line 1 after table. Do the same for line 9.

0

Thanks! that was the problem!

0

Thanks. I'll provide the answer with more detail.