lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The template library is now available as a LuaRock. For the template itself it doesn't make much sense (nor has anything substantial been updated), but it now includes a commandline script ('luacmodule [newmodulename]') that does the initial customizing/renaming. After installing the rock (regular 'luarocks install lualibrarytemplate')
You can now do for example;
>   luacmodule myNewModule

Which will generate a new Lua C module in place, including a rockspec to build it. So;
>   cd myNewModule
>   sudo luarocks make

Will instantly compile and install the new module, which can then be tested using;
>   lua -e "require([[myNewModule]]).somefunction([[one]], two, 3)"

Which will output;
> Now initializing module 'required' as:  myNewModule
> Now running somefunction...
> --------Start stack from somefunction()------------
> `one'  nil  3
> --------End Dump------------
> Now closing the Lua template library

All that is left to do is edit 'myNewModule.c' and implement your code.

Thanks to Hisham for providing his new 'datafile' module that transparently handles resource files!

Enjoy!
Thijs



> -----Original Message-----
> From: Thijs Schreijer
> Sent: maandag 13 januari 2014 10:32
> To: 'Lua mailing list'
> Subject: [ANN] Lua C library template
> 
> Hi list,
> 
> I finally got around to updating the template code to support Lua 5.2. The
> code is available from the github repo [1].
> 
> It is a library template for C libraries, with a fill-in-the-blanks
> approach.
> 
> Features:
>  - supports Lua 5.1 and 5.2
>  - supports Windows and Unix
>  - just scan the file for TODO comments to get going
>  - includes convenience debug code for dumping the stack and tables
>  - has an implemented 'close' method (though a UD with __GC method) builtin
>  - has both a Visual Studio project file and a command line compile script
> 
> Still missing
>  - a make file [no skills there, but contributions are welcome :) ]
> 
> A sample project is included; 'udtype' which is a `type()` replacement that
> in case of a userdata returns the name of the metatable as the second
> argument.
> 
> Comments are welcome.
> Thijs
> 
> [1] https://github.com/Tieske/Lua_library_template