summaryrefslogtreecommitdiff
path: root/src/rbglib.c
blob: aff8cc91564408a8fe0a2d1872ede1434178addd (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 <stdio.h>

#include <dos.h>
#include <i86.h>
#include <string.h>
#include <stdlib.h>

#include "lua.h"
#include "lauxlib.h"

static int rbg_present(lua_State *L)
{
    unsigned int res;

    res = (unsigned int)inp(8);

    lua_pushboolean(L, (res & 0x04));
    
    return 1;
}

static const luaL_Reg rbglib[] = {
  {"present",    rbg_present},
  {NULL, NULL}
};

LUAMOD_API int luaopen_rbg (lua_State *L) {
  luaL_newlib(L, rbglib);

  /* atexit(unload_timer); */
  
  return 1;
}