aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.md46
-rwxr-xr-xluatablegen.py2
2 files changed, 46 insertions, 2 deletions
diff --git a/README.md b/README.md
index 328d764..343a413 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,45 @@
-# luatablegen \ No newline at end of file
+# luatablegen
+
+`luatablegen` takes a list of C structures and generates lua tables in C.<br/>
+The input is in the form of a JSON file that describes the C structure and the Lua types you want.<br/>
+Each structure will have it's own pair of C source and header. There is an option for an aggregate header which will include all the headers and in has a function that registers all the tables with Lua.<br/>
+`luatablegen` will generate a lua file that includes default constructors for all tables which you can use in Lua with `require`. luatablegen will also generate a markdown file listing the methods for the tables.<br/>
+For an example you can look under the test directory.<br/>
+
+## table gen file
+
+Each entry in the JSON file should have the following fields:<br/>
+* field_name: a list of the names of the C structure field names.<br/>
+* field_type: a list of the names of the C types for the C structure fields.<br/>
+* lua_type: a list of the names of the lua types that the Lua table fields corresponding to the C structure fields will have.<br/>
+* methods: a list of the methods that will be generated for the Lua table corresponding to the C structure.<br/>
+
+## Options
+
+```bash
+ -h, --help show this help message and exit
+ --out OUT output directory
+ --tbg TBG the table gen file
+ --pre PRE path to source code file to add after header
+ guard/extern c
+ --post POST path to source code file to add before header
+ guard/extern c end
+ --luaheader LUAHEADER
+ path to lua header files
+ --dbg debug
+ --singlefile should all the generated code be added to a single
+ file
+ --makemacro generate a makefile containing all objects in a macro
+ to be included by another makefile
+ --outfile OUTFILE name of the output file if signlefile is set, ignored
+ otherwise
+ --headeraggr HEADERAGGR
+ header aggregate file name
+ --lualibpath LUALIBPATH
+ where the lua module file will be placed
+ --docpath DOCPATH where the doc file will be placed
+```
+
+## TODO
+* fields should be able to reference each other.<br/>
+* add more options for the table fileds.<br/>
diff --git a/luatablegen.py b/luatablegen.py
index 3fc39b3..c46f023 100755
--- a/luatablegen.py
+++ b/luatablegen.py
@@ -87,7 +87,7 @@ class Argparser(object):
parser.add_argument("--luaheader", type=str, help="path to lua header files")
parser.add_argument("--dbg", action="store_true", help="debug", default=False)
parser.add_argument("--singlefile", action="store_true", help="should all the generated code be added to a single file", default=False)
- parser.add_argument("--makemacro", action="store_true", help="generate a makefile containing all objects in a macro to be included by abother makefile", default=False)
+ parser.add_argument("--makemacro", action="store_true", help="generate a makefile containing all objects in a macro to be included by another makefile", default=False)
parser.add_argument("--outfile", type=str, help="name of the output file if signlefile is set, ignored otherwise")
parser.add_argument("--headeraggr", type=str, help="header aggregate file name")
parser.add_argument("--lualibpath", type=str, help="where the lua module file will be placed")