Comparison Functions

All comparison functions are mapped in the TB root table, using them it is really easy compare tables like they were records.

  • TB.Compare(table1, table2, compare_funcs)
  • TB.CompareScore(table1, table2, compare_funcs, count, equals)

You can find an example here.



TB.Compare(table1, table2, compare_funcs)

result = TB.Compare(table1, table2, compare_funcs)

Compare 'table1' and 'table2' and returns TRUE if they are equal.
Set 'compare_funcs' to TRUE if you want to compare function entries too. The comparisons are fully recursive and all items will be compared.

INPUT

  • table1 : The first table to compare
  • table2 : The second table to compare
  • compare_func : Set to TRUE to compare also function fields

OUTPUT

  • result : The result of the comparison: TRUE or FALSE


TB.CompareScore(table1, table2, compare_funcs, count, equals)

score, compared, equals = TB.CompareScore(table1, table2, compare_funcs, count, equals)

Compare 'table1' and 'table2' and returns a score. Set 'compare_funcs' to TRUE if you want to compare function entries too. The comparisons are recursive.

INPUT

  • table1 : The first table to compare
  • table2 : The second table to compare
  • compare_func : Set to TRUE to compare also function fields
  • count : This argument is used internally to handle recursive calls
  • equals : This argument is used internally to handle recursive calls

OUTPUT

  • score : The resulting score between 0 and 1 where 1 means identical tables.
  • compared : Count of the compared items
  • equals : Count of the identical items
hollywoodlibs/tables/comparison.txt · Ultima modifica: 2016/10/21 00:20 da admin
CC Attribution-Noncommercial 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0