summaryrefslogtreecommitdiffstats
path: root/src/luabind-test.cpp
blob: 02f2638fe945f64884629baec7bf8fa78f674fd6 (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()");
}