#ifndef LUA_OBJS_H
#define LUA_OBJS_H
/**
* @file
*
* Defines lua functions to access the various objects in a nexus
*/
#include "nexus_lua.h"
#include <lua5.1/lua.h>
#include <lua5.1/lauxlib.h>
/**
* Register a new metatable for a named type, this leaves the metatable on the stack.
*/
void lua_obj_create_type (lua_State *L, const char *name, const struct luaL_Reg methods[]);
/**
* Create a new userdata with the given type metatable name, return the pointer, and keep it on the stack.
*/
void* lua_obj_create_obj (lua_State *L, const char *name, size_t size);
/**
* Create a new metatable for a type, a userdata for that type, and register it as a global
*/
void* lua_obj_create_global_type (lua_State *L, const char *type_name, const struct luaL_Reg methods[], const char *global_name, size_t size);
/**
* Get a userdata with the given type metatable name as the first argument for a function.
*/
void* lua_obj_get_obj (lua_State *L, const char *func, const char *name);
/**
* Registers our lua runtime objects into the given lua state.
*
* Call in protected mode.
*/
void lua_objs_init (struct nexus_lua *lua);
#endif /* LUA_OBJS_H */