readdate.lua

Sun, 21 Jun 2009 17:42:50 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 21 Jun 2009 17:42:50 +0100
changeset 0
44416491923e
child 3
487f8d7b81b7
permissions
-rw-r--r--

Initial commit of ndp, the natural date processing library

0
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local ndp = require "ndp";
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local base;
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 for line in io.lines() do
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 if line:match("^base:%d+$") then
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 base = tonumber(line:match("^base:(%d+)$"));
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 else
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 local ret = ndp.when(line, 0, base);
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 print(os.date("%c", ret).." ("..ret..")");
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 end
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 end
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12

mercurial