Printing a function, table, or userdata returns a "weird string"

print({})image

I’ve noticed recently that my print()ing a function, table, or userdata returns a string prefixed with a unnormal amount of 0’s. My question is: Has it always been like this and I’m just noticing this, or is this a bug?

1 Like

I’m pretty sure this is normal behaviour. It’s always done this for me.

1 Like

It has always been like this.
All of the aforementioned tables, functions, etc are stored as a ‘pointer’ to a memory location.

don’t get pedantic on me mmkay?

This is related. You may already know this, but you can’t copy tables just by referencing them.

local a = {15, 17, 20}
local b = a
b[2] = -5
print(a[2],b[2]) --> -5, -5

Both tables are the same, and adding or removing anything from either changes both - because there aren’t actually two tables, it’s a memory reference to a single table.
I suppose a good way to think of it is that you have one object but it’s called by two different names.

Any ‘simple’ variable type would just copy to a separate variable:

local a = 5
local b = a
a = 10
print(a, b) --> 10, 5
1 Like

That’s because Studio is running in a higher bit than it did once upon a time! If you open this menu: image

You should see something like this:
image
Except instead of 32-bit, it will show 64-bit. If it doesn’t, this is a bug and you should report it.

That’s why the leading zeros are there anyways. There’s more memory available.

10 Likes

64 Bit:
image

1 Like

A post was merged into an existing topic: Off-topic and bump posts

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)