File: textlinewdx.lua

package info (click to toggle)
doublecmd 1.1.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 43,968 kB
  • sloc: pascal: 374,335; sh: 1,180; ansic: 724; makefile: 132; python: 52; xml: 16
file content (43 lines) | stat: -rw-r--r-- 858 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

function ContentGetSupportedField(Index)
  if (Index == 0) then
    return 'Line1','', 8; -- FieldName,Units,ft_string
  elseif (Index == 1) then
    return 'Line2','', 8;
  elseif (Index == 2) then
    return 'Line3','', 8;
  elseif (Index == 3) then
    return 'Line4','', 8;
  elseif (Index == 4) then
    return 'Line5','', 8;
  end
  return '','', 0; -- ft_nomorefields
end

function ContentGetDetectString()
  return '(EXT="TXT") | (EXT="INI")'; -- return detect string
end

function ContentGetValue(FileName, FieldIndex, UnitIndex, flags)

  if (FieldIndex > 4) then
    return nil;
  end

   local f=io.open(FileName,"r");
   if not f then
    return nil;
   end
    local ii = 0;
    for line in f:lines() do
       if (ii == FieldIndex) then
        f:close();
	return line;
       end
       ii = ii + 1;
    end

  f:close();

  return nil;
end