Search code examples
c++clualove2d

how to distribute a lua file with c++


I know how to do stuff with Lua states and what not but what i don't understand is how you would distribute the final program with a seperate lua file because say you have a .exe and a lua file in the same directory how would I make it so that it is all one executable like how Löve 2d uses

copy /b 

to append the lua file to the Löve 2d interpreter so it can be distributed. could someone possibly explain how this works.

many thanks Blazing


Solution

  • You could embed the lua code directly into your C++ source in a raw string literal like so:

    const auto lua_code = R"lua(
    ...lua code here...
    )lua";