diff options
author | scuri <scuri> | 2010-06-24 19:16:35 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-06-24 19:16:35 +0000 |
commit | da0f58cecf7a5280df7efa4e8d4443cb65b0fe1d (patch) | |
tree | d218429e378e665654db9a41e103e50f727e3e5e /src/lua5/cdluagl5.c | |
parent | 57d27736fe65aa25f8c03c790c11475cc06d1296 (diff) |
*** empty log message ***
Diffstat (limited to 'src/lua5/cdluagl5.c')
-rw-r--r-- | src/lua5/cdluagl5.c | 53 |
1 files changed, 53 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); +} + |