summaryrefslogtreecommitdiff
path: root/src/lua3/cdluagl.c
blob: 408eadb1ea6c690d33aae78701718901b46252ff (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
34
35
36
37
38
39
40
41
42
43
/** \file
 * \brief GL Canvas Lua 3 Binding
 *
 * See Copyright Notice in cd.h
 */

#include <stdlib.h>
#include <stdio.h>

#include "cd.h"
#include "cdgl.h"

#include <lua.h>
#include <lauxlib.h>

#include "cdlua.h"
#include "cdluagl.h"
#include "cdlua3_private.h"

static void *cdgl_checkdata(int param)
{
  lua_Object data = lua_getparam(param);
  if (!lua_isstring(data))
    lua_error("cdCreateCanvas CD_GL: data should be of type string!");

  return lua_getstring(data);
}

static cdContextLUA cdluaglctx = 
{
  0,
  "CD_GL",
  cdContextGL,
  cdgl_checkdata,
  NULL,
  0
};

void cdluagl_open(void)
{
  cdlua_addcontext(&cdluaglctx);
}