I want to create a lua script which will convert text to utf8 encoded string. The problem is I am using lua version 5.2 which does not support LUAJit which are having libraries to do so. So, I need a function which will do this task for me. For example I will pass "hey this is sam this side" it should give me the utf8 encoded string like "\x68\x65\x79\x20\x74\x68\x69\x73\x20\x69\x73\x20\x73\x61\x6d\x20\x74\x68\x69\x73\x20\x73\x69\x64\x65"
The requirement is like that need to use lua only.