Skip to content

Instantly share code, notes, and snippets.

@dylanwh
Created May 17, 2009 06:20
Show Gist options
  • Save dylanwh/112938 to your computer and use it in GitHub Desktop.
Save dylanwh/112938 to your computer and use it in GitHub Desktop.
/* Class-related functions {{{ */
gpointer ms_lua_toclass(LuaState *L, const char *class, int index)/*{{{*/
{
gpointer p = lua_touserdata(L, index);
if (p == NULL) luaL_typerror(L, index, class);
return p;
}/*}}}*/
gpointer ms_lua_checkclass(LuaState *L, const char *class, int index)/*{{{*/
{
luaL_checktype(L, index, LUA_TUSERDATA);
gpointer p = luaL_checkudata(L, index, class);
if (p == NULL) luaL_typerror(L, index, class);
return p;
}/*}}}*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment