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.
It would be nice if there were methods to obtain direct pointers to Lua strings. These would be an alternative to
CheckBufferandToBuffer, though I wouldn't mind ifOptBufferdidn't get the same treatment. These methods would be unsafe and return abyte*, 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
CheckBufferto 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, theNativeMethodsclass 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.