Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[koneki-dev] The Record-block/Type-block

Hi,
what is the purpose of the "field" list in a Type-block?

According to the Documenation_Language wiki page, a Record/Type-block is as follows:
------------------------------------------------------------------------------
-- short description.
-- long descrition 
-- @type #recordtypename
-- @field #typeref fieldtypedname description
-- @field fieldnottypedname description

One error is I don't believe a "#" belongs before the recordtypename for the type as shown above.

But I can't figure out a practical use for the @field portions.  They don't show up in the ctrl-space/info-help.  I was somewhat hoping they'd enable me to define enumerations, which is why I ask.

For example, many APIs have a fixed list of strings or Lua variable names that are defined in the global table, for use as function arguments.  It would be nice to identify those as the possible values for a function.  But I'm not sure if that's what they're for exactly, because when I use it in LDT it doesn't expand them in the places it should.

For example:

------------------------------------------------------------------------------
-- The PCRE regex library
-- @module regex

------------------------------------------------------------------------------
-- The PCRE flags
-- @type PcreFlags
-- @field #number PCRE_EXTENDED
-- @field #number PCRE_MULTILINE
-- @field #number PCRE_CASELESS

------------------------------------------------------------------------------
-- A function to compile a PCRE regex pattern
-- @function [parent=#regex] new
-- @param #string pattern
-- @param #PcreFlags flags --< see here the use of "PcreFlags"
-- @return #userdata The compiled regex object
-- @return #nil, #string Returns nil and error string on failure

BTW, the @return model is a bit confusing.  The wiki page "Lua_API_Model_2" implies two @return lies are alternatives (the function returns one or the other), while two values in the same @return line are both returned if that return case occurs.  In other words, as I show above for the regex.new() function.  Correct?



Back to the top