I looked at it on the Internet, but I found There are not any examples that can help me. I can call Lua functions from C, but this requires you to create a file with Lua functions.
I want to pass a Lua script from C (code that the Lua interpreter can handle ) And return the result.
I looked online, but couldn’t find any examples that can help me. I can call Lua functions from C, but this requires you to create a Lua function File.
Try to use luaL_dostring, which loads and runs the given string.