Skip to content

Add methods to obtain pointers to Lua strings directly #92

@pkhead

Description

@pkhead

It would be nice if there were methods to obtain direct pointers to Lua strings. These would be an alternative to CheckBuffer and ToBuffer, though I wouldn't mind if OptBuffer didn't get the same treatment. These methods would be unsafe and return a byte*, of course, or probably an IntPtr.

My use case is for passing Lua strings directly into a function loaded from a C library. Currently, I have to use CheckBuffer to obtain the unprocessed character data, then allocate a new byte buffer with an extra byte allocated for the null byte, and then pass it to the C function. This extra processing is a waste of time. Plus, the NativeMethods class is internal, so I couldn't sanely access the function I wanted.

If instead this issue was implemented, it would give me peace of mind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions