summaryrefslogtreecommitdiff
path: root/tests/test-Lua.cc
blob: 86baffb1383265b6c587134152a22588a869990b (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
30
31
32
33
#include <Main.h>
#include <BLua.h>

BALAU_STARTUP;

using namespace Balau;

void MainTask::Do() {
    Printer::log(M_STATUS, "Test::Lua running.");

    Lua L;

    // yeah, they really should be the same thing.
    Assert(sizeof(L) == sizeof(lua_State *));

    L.open_base();
    L.open_table();
    L.open_string();
    L.open_math();
    L.open_debug();
    L.open_bit();
    L.open_jit();

    Assert(L.gettop() == 0);
    L.load("return 42");
    Assert(L.gettop() == 1);
    int r = L.tonumber();
    Assert(r == 42);
    L.pop();
    Assert(L.gettop() == 0);

    Printer::log(M_STATUS, "Test::Lua passed.");
}