If you want to explore passing UTF-8 string data to/from LuaTeX to your C code/library you may want to convert the UTF-8 data back into Unicode code points (reversing the UTF-8 encoding process discussed in this post). To do that you’ll need a UTF-8 decoder: here is a nice implementation of a UTF-8 decoder in C. Examples, source code and explanations are available from The Flexible and Economical UTF-8 Decoder. Just to note that irrespective of the decoder you use make sure you read up and are aware of UTF-8 security exploits.