//Get position of last dot in current line (useful for parsing table).
char *dot = strrchr(argv[0], '.');
- if (strncmp(type, "table", 5) && !dot) {
+ if (strncmp(type, "table", 5) != 0 && !dot) {
//Line is not a name of some table and there is no dot in it.
complete_globals(el, argv[0], pos);
- } else if ((dot && !strncmp(type, "nil", 3))
- || !strncmp(type, "table", 5)) {
+ } else if ((dot && strncmp(type, "nil", 3) == 0)
+ || strncmp(type, "table", 5) == 0) {
//Current line (or part of it) is a name of some table.
complete_members(el, argv[0], type, pos, dot);
- } else if (!strncmp(type, "function", 8)) {
+ } else if (strncmp(type, "function", 8) == 0) {
//Current line is a function.
complete_function(el);
}