diff options
author | Nicholas LĂ©onard <nick@nikopia.org> | 2017-04-25 17:28:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 17:28:32 +0300 |
commit | a2873a95a500e03c8f7eeb363cdb7058cc297f5b (patch) | |
tree | 932121f83ba66f559fb052b5275bf9c49beaee5b | |
parent | 7c26baf41b3e29d6b99473300d07cace1d34a764 (diff) |
fix HTML anchors in luaT doc
-rw-r--r-- | lib/luaT/README.md | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/lib/luaT/README.md b/lib/luaT/README.md index f28d143..3550e4e 100644 --- a/lib/luaT/README.md +++ b/lib/luaT/README.md @@ -1,4 +1,4 @@ -<a name="luat.dok"/> +<a name="luat.dok"></a> # Lua Torch C API # luaT provides an API to interface Lua and C in Torch packages. It defines a @@ -9,19 +9,19 @@ It additionally provides few functions that `luaL` should have defined, and defines several functions similar to `luaL` ones for better type error printing when using `luaT` classes. -<a name="luat.memory.dok"/> +<a name="luat.memory.dok"></a> ## Memory functions ## Classical memory allocation functions which generate a Lua error in case of problem. -<a name="luaT_alloc"/> +<a name="luaT_alloc"></a> ### void* luaT_alloc(lua_State *L, long size) ### Allocates `size` bytes, and return a pointer on the allocated memory. A Lua error will be generated if running out of memory. -<a name="luaT_realloc"/> +<a name="luaT_realloc"></a> ### void* luaT_realloc(lua_State *L, void *ptr, long size) ### Realloc `ptr` to `size` bytes. `ptr` must have been previously @@ -29,7 +29,7 @@ allocated with [luaT_alloc](#luaT_alloc) or [luaT_realloc](#luaT_realloc), or the C `malloc` or `realloc` functions. A Lua error will be generated if running out of memory. -<a name="luaT_free"/> +<a name="luaT_free"></a> ### void luaT_free(lua_State *L, void *ptr) ### Free memory allocated at address `ptr`. The memory must have been @@ -37,7 +37,7 @@ previously allocated with [luaT_alloc](#luaT_alloc) or [luaT_realloc](#luaT_realloc), or the C `malloc` or `realloc` functions. -<a name="luat.classcreate"/> +<a name="luat.classcreate"></a> ## Class creation and basic handling ## A `luaT` class is basically either a Lua _table_ or _userdata_ with @@ -48,7 +48,7 @@ another class, then the metatable will itself have a metatable corresponding to the _parent metatable_: the metatables are cascaded according to the class inheritance. Multiple inheritance is not supported. -<a name="luat.operatoroverloading"/> +<a name="luat.operatoroverloading"></a> ### Operator overloading ### The metatable of a `luaT` object contains `Lua` operators like @@ -67,7 +67,7 @@ metaclass, these operators must follow a particular scheme: Other metaclass operators like `__tostring__`, `__add__`, etc... do not have any particular constraint. -<a name="luat_newlocalmetatable"/> +<a name="luat_newlocalmetatable"></a> ### const char* luaT_newlocalmetatable(lua_State *L, const char *tname, const char *parenttname, lua_CFunction constructor, lua_CFunction destructor, lua_CFunction factory, int moduleidx) ### This function creates a new metatable, which is the Lua way to define a new @@ -100,13 +100,13 @@ methods in Lua. The return value is the value returned by [luaT_typenameid](#luat_typenameid). -<a name="luat_newmetatable"/> +<a name="luat_newmetatable"></a> ### const char* luaT_newmetatable(lua_State *L, const char *tname, const char *parenttname, lua_CFunction constructor, lua_CFunction destructor, lua_CFunction factory) ### Same as [luaT_newlocalmetatable](#luat_newmetatable), but where the constructor table is assigned in the global namespace (`moduleidx = 0`). -<a name="luat_pushmetatable"/> +<a name="luat_pushmetatable"></a> ### int luaT_pushmetatable(lua_State *L, const name *tname) ### Push the metatable with type name `tname` on the stack, if `tname` is a @@ -115,7 +115,7 @@ valid Torch class name (previously registered with luaT_newmetatable). On success, returns 1. If `tname` is invalid, nothing is pushed and it returns 0. -<a name="luat_typenameid"/> +<a name="luat_typenameid"></a> ### const char* luaT_typenameid(lua_State *L, const char *tname) ### If `tname` is a valid Torch class name, then returns a unique string (the @@ -125,40 +125,40 @@ running. The returned string shall not be freed. If `tname` is an invalid class name, returns NULL. -<a name="luat_typename"/> +<a name="luat_typename"></a> ### const char* luaT_typename(lua_State *L, int ud) ### Returns the typename of the object at index `ud` on the stack. If it is not a valid Torch object, returns NULL. -<a name="luat_pushudata"/> +<a name="luat_pushudata"></a> ### void luaT_pushudata(lua_State *L, void *udata, const char *tname) ### Given a C structure `udata`, push a userdata object on the stack with metatable corresponding to `tname`. Obviously, `tname` must be a valid Torch name registered with [luaT_newmetatable](#luat_newmetatable). -<a name="luat_toudata"/> +<a name="luat_toudata"></a> ### void *luaT_toudata(lua_State *L, int ud, const char *tname) ### Returns a pointer to the original C structure previously pushed on the stack with [luaT_pushudata](#luat_pushudata), if the object at index `ud` is a valid Torch class name. Returns NULL otherwise. -<a name="luat_isudata"/> +<a name="luat_isudata"></a> ### int luaT_isudata(lua_State *L, int ud, const char *tname) ### Returns 1 if the object at index `ud` on the stack is a valid Torch class name `tname`. Returns 0 otherwise. -<a name="luat_getfield"/> +<a name="luat_getfield"></a> ### Checking fields of a table ### This functions check that the table at the given index `ud` on the Lua stack has a field named `field`, and that it is of the specified type. These function raises a Lua error on failure. -<a name="luat_getfieldcheckudata"/> +<a name="luat_getfieldcheckudata"></a> ## void *luaT_getfieldcheckudata(lua_State *L, int ud, const char *field, const char *tname) ## Checks that the field named `field` of the table at index `ud` is a @@ -166,99 +166,99 @@ Torch class name `tname`. Returns the pointer of the C structure previously pushed on the stack with [luaT_pushudata](#luat_pushudata) on success. The function raises a Lua error on failure. -<a name="luat_getfieldchecklightudata"/> +<a name="luat_getfieldchecklightudata"></a> ## void *luaT_getfieldchecklightudata(lua_State *L, int ud, const char *field) ## Checks that the field named `field` of the table at index `ud` is a lightuserdata. Returns the lightuserdata pointer on success. The function raises a Lua error on failure. -<a name="luat_getfieldcheckint"/> +<a name="luat_getfieldcheckint"></a> ## int luaT_getfieldcheckint(lua_State *L, int ud, const char *field) ## Checks that the field named `field` of the table at index `ud` is an int. Returns the int value pointer on success. The function raises a Lua error on failure. -<a name="luat_getfieldcheckstring"/> +<a name="luat_getfieldcheckstring"></a> ## const char* luaT_getfieldcheckstring(lua_State *L, int ud, const char *field) ## Checks that the field named `field` of the table at index `ud` is a string. Returns a pointer to the string on success. The function raises a Lua error on failure. -<a name="luat_getfieldcheckboolean"/> +<a name="luat_getfieldcheckboolean"></a> ## int luaT_getfieldcheckboolean(lua_State *L, int ud, const char *field) ## Checks that the field named `field` of the table at index `ud` is a boolean. On success, returns 1 if the boolean is `true`, 0 if it is `false`. The function raises a Lua error on failure. -<a name="luat_getfieldchecktable"/> +<a name="luat_getfieldchecktable"></a> ## void luaT_getfieldchecktable(lua_State *L, int ud, const char *field) ## Checks that the field named `field` of the table at index `ud` is a table. On success, push the table on the stack. The function raises a Lua error on failure. -<a name="luat_typerror"/> +<a name="luat_typerror"></a> ### int luaT_typerror(lua_State *L, int ud, const char *tname) ### Raises a `luaL_argerror` (and returns its value), claiming that the object at index `ud` on the stack is not of type `tname`. Note that this function does not check the type, it only raises an error. -<a name="luat_checkboolean"/> +<a name="luat_checkboolean"></a> ### int luaT_checkboolean(lua_State *L, int ud) ### Checks that the value at index `ud` is a boolean. On success, returns 1 if the boolean is `true`, 0 if it is `false`. The function raises a Lua error on failure. -<a name="luat_optboolean"/> +<a name="luat_optboolean"></a> ### int luaT_optboolean(lua_State *L, int ud, int def) ### Checks that the value at index `ud` is a boolean. On success, returns 1 if the boolean is `true`, 0 if it is `false`. If there is no value at index `ud`, returns `def`. In any other cases, raises an error. -<a name="luat_registeratname"/> +<a name="luat_registeratname"></a> ### void luaT_registeratname(lua_State *L, const struct luaL_Reg *methods, const char *name) ### This function assume a table is on the stack. It creates a table field `name` in the table (if this field does not exist yet), and fill up `methods` in this table field. -<a name="luat_classrootname"/> +<a name="luat_classrootname"></a> ### const char *luaT_classrootname(const char *tname) ### Assuming `tname` is of the form `A.b.c`, returns 'c'. The returned value shall not be freed. It is a pointer inside `tname` string. -<a name="luat_classmodulename"/> +<a name="luat_classmodulename"></a> ### int luaT_classmodulename(const char *tname, char *parent_name) ### Alias to `luaT_fullparentname ` for ensuring backwards compatibility; use of `luaT_fullparentname` is preferred. -<a name="luat_fullparentname"/> +<a name="luat_fullparentname"></a> ### int luaT_fullparentname(const char *tname, char *parent_name) ### Returns a 0-1 valued integer indicating whether `tname` has a parent module. Assuming `tname` is of the form `A.b.c`, sets `parent_name` to `A.b`. -<a name="luat_classmodulename"/> +<a name="luat_classmodulename"></a> ### int luaT_outerparentname(const char *tname, char *parent_name) ### Returns a 0-1 valued integer indicating whether `tname` has a parent module. Assuming `tname` is of the form `A.b.c`, sets `parent_name` to `A`. -<a name="luat_classmodulename"/> +<a name="luat_classmodulename"></a> ### int luaT_innerparentname(const char *tname, char *parent_name) ### Returns a 0-1 valued integer indicating whether `tname` has a parent module. Assuming `tname` is of the form `A.b.c`, sets `parent_name` to `b`. -<a name="luat_stackdump"/> +<a name="luat_stackdump"></a> ### void luaT_stackdump(lua_State *L) ### This function print outs the state of the Lua stack. It is useful for debug |