0

I am started to learn Lua few days ago and faced next problem. How can I run the whole lua script form C program, for example, I have a lua script and read it like a text file in my C program so how can I run this script from C side?

0

1 Answer 1

4

By using luaL_dofile. even no need to read the text file in separately.

In Programming in Lua, they do it using luaL_loadfile (to allow for some more flexibility)

Sign up to request clarification or add additional context in comments.

2 Comments

But now I faced one more problem, how can I create a table in Lua from C-side, and then pass this table to the function
This is a different question, but I could give you the general hint of reading the pil book I linked in my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.