Jump to content
  • Advertisement
Sign in to follow this  
minardogl

Lua with C++

This topic is 3998 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!