lua-users home
lua-l archive

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


Hi,


I plan to use lua in my software. So I will have many files with pre-defined structure (in lua syntax) generated by some others softwares or user generated. This files contains complex data structure to be processed by my software.

Is there a way to check if lua files match predifined structure before starting to work with.

For exemple, I plan to use something like this schema description:

Schema = {
  _Return = 0..n , -- Nb objects returned by lua module
  _Structure[n] = {   -- structure of returned Object at pos n
    ElementName = {
      _Optional = nil | not nil, -- must be present or not
      _Type = number | string | function | any | ..., -- lua type + any
      SubElementName = {  -- if _Type == 'table'
		....
      },
    },
    OtherElementName = {
      ....
    },
    ....
    _Array = {     -- if can be an array
      _Type = ....
      ...
    },
  }
}

But is there already some starting work on this kind of functionnality.

Best regards,


--
Jean-Claude Morlier      __O
morlier@quetzal.fr     _`\<,_
......................(*)/ (*)