From da0f58cecf7a5280df7efa4e8d4443cb65b0fe1d Mon Sep 17 00:00:00 2001 From: scuri Date: Thu, 24 Jun 2010 19:16:35 +0000 Subject: *** empty log message *** --- src/lua5/cdluagl5.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/lua5/cdluagl5.c (limited to 'src/lua5/cdluagl5.c') 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 +#include + +#include "cd.h" +#include "cdgl.h" + +#include +#include + +#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); +} + -- cgit v1.2.3