summaryrefslogtreecommitdiff
path: root/Data/Libraries/LDoc/tests/styles/x.c
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-30 11:42:13 +0800
committerchai <chaifix@163.com>2021-10-30 11:42:13 +0800
commit53364ddc2e09362cb17432abf4fb598557554a9f (patch)
tree8d2deafc82aceb13db31938a2aecc70927fc1457 /Data/Libraries/LDoc/tests/styles/x.c
parent42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce (diff)
+ LDoc
Diffstat (limited to 'Data/Libraries/LDoc/tests/styles/x.c')
-rw-r--r--Data/Libraries/LDoc/tests/styles/x.c46
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;
+}