File: test_out_value.cpp

package info (click to toggle)
luabind 0.9.1%2Bgit20150823%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,692 kB
  • sloc: cpp: 14,884; makefile: 204; sh: 41; python: 38; ansic: 11
file content (25 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (2)
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
// Currently fails to compile (See
// https://github.com/Oberon00/luabind/issues/30)

#include "test.hpp"

#include <luabind/luabind.hpp>
#include <luabind/out_value_policy.hpp>

void f(float& val) { val = val + 10.f; }

void test_main(lua_State* L)
{
    using namespace luabind;

    module(L)
    [
         def("f", &f, out_value(_1)) // compiles with "pure_out_value"
    ];

    // out_value
    DOSTRING(L,
        "a = f(5)\n"
        "assert(a == 15)");

}