|
Hi
I want to write a C function that takes a UTF8 Lua string and in C break it down into codepoints, each codepoint I want to insert into a Lua table using the API and return that table to Lua. I am OK with the UTF8 parsing (I have already written that) what I am unsure about is how to return the table to Lua when it has potentially 1000 or so codepoints in the table ? I have previously written a binding that populates a small table and returns it to Lua, this was maybe 5 elements max, so I didnt even need to worry about the stack size. My first question is, is this same technique still valid and sound if you have to potentially push a few thousand elements onto the stack to return a big table ? if the answer to that is yes, can you point me at an example of how to grow the stack to suit as needed, and what do I need to do to shrink the stack when I have finished with this function ? If however returning a big table by pushing it all on the stack, is not sound practice, how should this be achieved instead ? Any links to study ? Thanks for any help Regards Geoff |