Lua helloworld

#include 
#include 

void greet()
{
    std::cout << "hello world!\n";
}

extern "C" int init( lua_State* L )
{
    using namespace luabind;
    open( L );
    module( L )[def( "greet", &greet )];
    return 0;
}
g++ hello_world.cc -fPIC -shared -o hello_world.so -I /usr/include/lua5.1 -llua5.1 -lluabind
Screenshot from 2019-10-08 11:10:57.png

你可能感兴趣的:(Lua helloworld)