4

I'm trying to print out some userdata as a string, but the documentation for lua pretty weak to nonexistant. How do I convert a userdata variable to a string so that I can write it to a file?

1 Answer 1

5

tostring(userdata)

Creator of that userdata must provide __tostring metamethod.

Sign up to request clarification or add additional context in comments.

1 Comment

agreed. Or you'll get just userdata: 0xdeadbeef if that metamethod wasn't specified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.