aboutsummaryrefslogtreecommitdiff
path: root/tests/C/lua_pushinteger.c
blob: da134b6c9cb6cd3a07a87c45c9f4242072dcdd89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <stdio.h>

int main(void) {

    lua_State *L = luaL_newstate();

    luaL_openlibs(L);

    lua_pushinteger(L, 10);

    printf("L->top(%d): type %s, value %ld\n", lua_gettop(L), luaL_typename(L, lua_gettop(L)), lua_tointeger(L, -1));

    lua_close(L);

    return 0;

}