diff options
Diffstat (limited to 'Data/Libraries/LDoc/tests/styles/x.c')
-rw-r--r-- | Data/Libraries/LDoc/tests/styles/x.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Data/Libraries/LDoc/tests/styles/x.c b/Data/Libraries/LDoc/tests/styles/x.c new file mode 100644 index 0000000..fc8dffc --- /dev/null +++ b/Data/Libraries/LDoc/tests/styles/x.c @@ -0,0 +1,46 @@ +/*************** + * First comment is ignored, + * containing licenses, warnings, + * old-fashioned commit info and so forth + */ + +/** No-brainer C extension. +Description as before. +@module x +*/ +#include <lua.h> +#include <lauxlib.h> +#include <lualib.h> + +/*** +@string name +@int age +@table output +*/ + +/*** +Create a table with given array and hash slots. +Note that we can't (yet) deduce the name of +the Lua function. +@function createtable +@param narr initial array slots, default 0 +@param nrec initial hash slots, default 0 +@return table +*/ +static int l_createtable (lua_State *L) { + int narr = luaL_optint(L,1,0); + int nrec = luaL_optint(L,2,0); + lua_createtable(L,narr,nrec); + return 1; +} + +static const luaL_reg x[] = { + {"createtable",l_createtable}, + {NULL,NULL} +}; + +int luaopen_x(lua_State *L) +{ + luaL_register (L, "x", x); + return 1; +} |