Skip to content

Instantly share code, notes, and snippets.

@zhaozg
Last active August 29, 2015 14:07
Show Gist options
  • Save zhaozg/6a131e18453398446e53 to your computer and use it in GitHub Desktop.
Save zhaozg/6a131e18453398446e53 to your computer and use it in GitHub Desktop.
template with ldco.lua
------------
-- Title module.
-- Description can continue after simple tags, if you
-- like - but to keep backwards compatibility, say 'not_luadoc=true'
-- @module four
-- @author bob, james
-- @license MIT
-- @copyright InfoReich 2013
-- @usage
do --define module function
--- a function with typed args.
-- Note the the standard tparam aliases, and how the 'opt' and 'optchain'
-- modifiers may also be used. If the Lua function has varargs, then
-- you may document an indefinite number of extra arguments!
-- @tparam ?string|Person name person's name
-- @int age
-- @string[opt='gregorian'] calender optional calendar
-- @int[opt=0] offset optional offset
-- @treturn string
function one (name,age,...)
end
---- testing [opt]
-- @param one
-- @param[opt] two
-- @param three
-- @param[opt] four
function two (one,two,three,four)
end
--- third useless function.
-- Can always put comments inline, may
-- be multiple.
-- note that first comment is refers to return
function three ( -- person:
name, -- string: person's name
age -- int:
-- not less than zero!
)
---- function with single optional arg
-- @param[opt] one
function four (one)
end
end -- define module
do --define table
--- an implicit table.
-- Again, we can use the comments
person = {
name = '', -- string: name of person
age = 0, -- int:
}
--- an explicit table.
-- Can now use tparam aliases in table defns
-- @string name
-- @int age
-- @table person2
end --define table
do -- define class
--- openssl.hmac_ctx object
-- @type hmac_ctx
--
do -- define hmac_ctx
--- feed data to do digest
--
-- @tparam string msg data
function update() end
--- get result of hmac
--
-- @tparam[opt] string last last part of data
-- @tparam[opt] boolean raw binary or hex encoded result, default true for binary result
-- @treturn string val hash result
function final() end
--- reset hmac_ctx to reuse
--
function reset() end
end --define class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment