Visual C++ with Lua

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
hi all

Is it possible to put codes Lua in Microsoft Visual C++ programs ?

if possible i need to see How .

If not possible, why ?
lua is written in c++ and is intended to be used within c++, and a long list of wrappers are available to be used in other platforms.

For using it you only need to place lua libs in your library path and setup all the header files of lua needed to use the lua C api.

When you're done you can directly execute char* buffers of code with luaL_dostring(...) or (much more effective and correct) using c api. Since lua has a stackable engine you should add operation to the stack pointer. There are a lots of manual about that on internet, official lua page, or this forum.

In addition, you are able to use this tool to figure out how this stack works. You can place your lua code and press "lua2c", that will dump the equivalent c api code.

For example
a=1
b="a"
c=true
myvariable=functionname(a,b,{c,a})
will trow
static int MAIN(lua_State *L)
{
lua_pushnumber(L,1);
lua_setglobal(L,"a");
lua_pushstring(L,"a");
lua_setglobal(L,"b");
lua_getglobal(L,"true");
lua_setglobal(L,"c");
lua_getglobal(L,"functionname");
lua_getglobal(L,"a");
lua_getglobal(L,"b");
lua_newtable(L);
lua_getglobal(L,"c");
lua_getglobal(L,"a");
lua_rawseti(L,-3,2);
lua_rawseti(L,-2,1);
lua_call(L,3,1);
lua_setglobal(L,"myvariable");
return 0;
}
Thank you very much Pabloko ;) :friends:
Wow this is new to me, as i know c++ is one of language to make a games. hmmmm i'm curious what if you all Ceone, Rafax, or you abood make some tutorial to make some simple games in this very great forum? as i know this AMS can make poker games in they website, but what if another type of games, like angry birds ,,hehe.. or just others games for kids, i apreciate if this forum facilitate my idea. So not just aplication AMS can do, but it can make great games, even for online games with social media support :friends: :pc:

i post a new topic for this in here http://amsspecialist.com/viewtopic.php? ... 794#p16794