summaryrefslogtreecommitdiff
path: root/src/lua5
diff options
context:
space:
mode:
authorscuri <scuri>2010-06-24 19:16:35 +0000
committerscuri <scuri>2010-06-24 19:16:35 +0000
commitda0f58cecf7a5280df7efa4e8d4443cb65b0fe1d (patch)
treed218429e378e665654db9a41e103e50f727e3e5e /src/lua5
parent57d27736fe65aa25f8c03c790c11475cc06d1296 (diff)
*** empty log message ***
Diffstat (limited to 'src/lua5')
-rw-r--r--src/lua5/cdluagl5.c53
-rw-r--r--src/lua5/cdluagl5.def3
2 files changed, 56 insertions, 0 deletions
diff --git a/src/lua5/cdluagl5.c b/src/lua5/cdluagl5.c
new file mode 100644
index 0000000..ad81730
--- /dev/null
+++ b/src/lua5/cdluagl5.c
@@ -0,0 +1,53 @@
+/** \file
+ * \brief OpenGL Canvas Lua 5 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 "cdlua5_private.h"
+
+
+static void *cdgl_checkdata(lua_State *L, int param)
+{
+ return (void *)luaL_checkstring(L, param);
+}
+
+static cdluaContext cdluaglctx =
+{
+ 0,
+ "GL",
+ cdContextGL,
+ cdgl_checkdata,
+ NULL,
+ 0
+};
+
+int cdluagl_open (lua_State *L)
+{
+ cdluaLuaState* cdL = cdlua_getstate(L);
+ lua_pushliteral(L, "cd");
+#if LUA_VERSION_NUM > 501
+ lua_pushglobaltable(L);
+#else
+ lua_gettable(L, LUA_GLOBALSINDEX); /* leave "cd" table at the top of the stack */
+#endif
+ cdlua_addcontext(L, cdL, &cdluaglctx);
+ return 1;
+}
+
+int luaopen_cdluagl(lua_State* L)
+{
+ return cdluagl_open(L);
+}
+
diff --git a/src/lua5/cdluagl5.def b/src/lua5/cdluagl5.def
new file mode 100644
index 0000000..80e1e2d
--- /dev/null
+++ b/src/lua5/cdluagl5.def
@@ -0,0 +1,3 @@
+EXPORTS
+ cdluagl_open
+ luaopen_cdluagl