dev
dev

Reputation: 2200

passing Lua script from C++ to Lua

I want to pass a Lua script (code that Lua interpreter can process) from C++ and get the result back.

I looked online but could not find any example that would help me. I am able to call a Lua function from C++, but that requires you to create a file with Lua function.

Upvotes: 4

Views: 386

Answers (1)

lhf
lhf

Reputation: 72402

Try using luaL_dostring, which loads and runs a given string.

Upvotes: 6

Related Questions