Skip to content

Suggestion: make print(x) and typeof(x) call ToString() and GetType() (for userdata specifically) #206

@CodeSmile-0000011110110111

Description

It would be non-standard but C Lua outputs any userdata as a 'useless' string only because it can't make a pointer "print itself":

print(userdata)
output: "userdata 34953678"

In C# however we have ToString() so I would expect that to get called:

print(userdata)
output: "LuaVector3(1,2,3)"

-- and for null values
print(nullluserdata)
output: "userdata(null)"

And similar with type() although the standard type(x) == "userdata" must still work.
Thus I suggest adding typeof(x) to basic library, it returns GetType().FullName.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions