i was doing some stuff with tables and when i outputed the table i got instead of
{["Colors"] = {"Red","Yellow","Blue"}}
i got
table: 0xac5a54b7189b4c52
do you know how to fix it?
i was doing some stuff with tables and when i outputed the table i got instead of
{["Colors"] = {"Red","Yellow","Blue"}}
i got
table: 0xac5a54b7189b4c52
do you know how to fix it?
This is a memory address.
Disable Log mode
in the output menu (three dots in the top right corner of the output window, right from the clear
button).
Did you print this in studio or in a live game
Show the code where the table is being outputted
try:
local maintable = {["Colors"] = {"Red","Yellow","Blue"},["Trash"] = {"Red","Yellow","Blue"}}
for i,v in pairs(maintable.Colors) do
print(i,v)
end
The output you received, table: 0xac5a54b7189b4c52
, is the default representation of a table when you print it directly using print
or tostring
. It does not show the contents of the table.
To display the contents of a table, you can use the print
function in combination with the table.concat
function. Here’s an example of how you can print the contents of your table:
local myTable = {
Colors = {"Red", "Yellow", "Blue"}
}
print("Table Contents:")
for key, value in pairs(myTable) do
if type(value) == "table" then
print(key .. ": " .. table.concat(value, ", "))
else
print(key .. ": " .. tostring(value))
end
end
This code will iterate over the key-value pairs of the table. If a value is of type “table,” it will use table.concat
to concatenate the elements into a string separated by commas. Otherwise, it will use tostring
to convert the value to a string.
When you run this code, it should output the contents of your table in a readable format:
Table Contents:
Colors: Red, Yellow, Blue
This way, you can see the actual contents of the table instead of the default representation.
thanks dude i really appreciate it
i have another this type related question i tried to outputting the loadstring() and i got function: 0xa…
how do i expand that
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.