Sign in to follow this  
minardogl

Lua with C++

Recommended Posts

I need a code, using Lua5.1.2 that allows me to load a Lua file and print the name of all the functions that have the document. Please any people that have an example or tutorial send It to me because I have not been able to make an example that loads lua and execute it correctly using the latest libraries.

Share this post


Link to post
Share on other sites
What does "print the name of all the functions that have the document" mean?
Can you rephrase the question?

Are you looking for a simple hello world tutorial for newer lua versions? It's pretty simple:


// 5.1 setup
lua_State* lua = luaL_newstate();
luaL_openlibs(lua);

// open file
char* file = "test.lua";
luaL_loadfile(lua, file);

// execute
lua_pcall (lua, 0, LUA_MULTRET, 0);

// close
lua_close(lua);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this