diff -r 5229a5d098b2 -r cefec18b8268 src/lua_type.h --- a/src/lua_type.h Thu May 28 00:35:02 2009 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -#ifndef LUA_TYPE_H -#define LUA_TYPE_H - -/** - * @file - * - * Convenience functions for defining "types" in lua - */ -#include - -// XXX: remove -#include - -/** - * A type's method - * - * XXX: a name field? - */ -struct lua_method { - /** The name of the method */ - const char *name; - - /** The function pointer */ - lua_CFunction func; - - /** The function definition, optional */ - const struct lua_func *info; -}; - -#define LUA_METHOD(name, func, info) \ - { (name), (func), (info) } - -#define LUA_METHODS(...) \ - { __VA_ARGS__, { NULL, NULL, NULL } } - -/** - * A type - */ -struct lua_type { - /** The name of the type */ - const char *name; -}; - -#define LUA_TYPE(name) \ - { (name) } - -/** - * Register a new metadata table for the given type in the given lua state. - * - * This leaves the new type (metatable) on the stack. - */ -void lua_type_register (lua_State *L, const struct lua_type *type, const struct lua_method methods[]); - -/** - * Create a new instance of the given type. - * - * This leaves the new userdata object on the stack. - */ -void* lua_type_create (lua_State *L, const struct lua_type *type, size_t size); - -/** - * Create a new userdata type, and also create an instance of it, register it as a global, and return it. - * - * This leaves the new userdata object on the stack. - */ -void* lua_type_register_global (lua_State *L, const struct lua_type *type, const struct lua_method methods[], - const char *global_name, size_t size); - -/** - * Get an object of the given type from the given stack position - */ -void* lua_type_get (lua_State *L, const struct lua_type *type, int index); - -#endif