summaryrefslogtreecommitdiffstats
path: root/src/luabind-test.cpp
blob: 45efb3d2af1f0d548d57788e1cb737f25734e6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include <luabind/luabind.hpp>
#include <lua.hpp>

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;
}

int main()
{
    lua_State* L = luaL_newstate();
    init(L);
    luaL_dostring(L, "greet()");
}