mirror of
https://github.com/TangentFoxy/lua-date.git
synced 2025-07-28 11:02:17 +00:00
Lua 5.2 compatibility
This commit is contained in:
5
date.lua
5
date.lua
@@ -30,7 +30,7 @@
|
|||||||
local string = string
|
local string = string
|
||||||
local math = math
|
local math = math
|
||||||
local os = os
|
local os = os
|
||||||
local unpack = unpack
|
local unpack = unpack or table.unpack
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
local getmetatable = getmetatable
|
local getmetatable = getmetatable
|
||||||
--[[ EXTRA FUNCTIONS ]]--
|
--[[ EXTRA FUNCTIONS ]]--
|
||||||
@@ -198,8 +198,7 @@
|
|||||||
--[[ THE DATE MOUDLE ]]--
|
--[[ THE DATE MOUDLE ]]--
|
||||||
local fmtstr = "%x %X";
|
local fmtstr = "%x %X";
|
||||||
--#if not DATE_OBJECT_AFX then
|
--#if not DATE_OBJECT_AFX then
|
||||||
date = {}
|
local date = {}
|
||||||
local date = date
|
|
||||||
setmetatable(date, date)
|
setmetatable(date, date)
|
||||||
-- Version: VMMMRRRR; V-Major, M-Minor, R-Revision; e.g. 5.45.321 == 50450321
|
-- Version: VMMMRRRR; V-Major, M-Minor, R-Revision; e.g. 5.45.321 == 50450321
|
||||||
date.version = 20000000 -- 2.0.0
|
date.version = 20000000 -- 2.0.0
|
||||||
|
BIN
doc/date.doc.chm
BIN
doc/date.doc.chm
Binary file not shown.
@@ -1,11 +1,11 @@
|
|||||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>LuaDate v2</title><link rel="stylesheet" href="main.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.70.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id90891"></a>LuaDate v2</h2></div><div><h3 class="subtitle"><i>Lua Date and Time module for Lua 5.x.</i></h3></div><div><div class="author"><h3 class="author"><span class="firstname">Jas</span> <span class="surname">Latrix</span></h3></div></div><div><p class="copyright">Copyright <20> 2005, 2006 Jas Latrix <code class="email"><<a href="mailto:jastejada@yahoo.com">jastejada@yahoo.com</a>></code></p></div><div><div class="legalnotice"><a name="id349744"></a>All Rights Deserved. Use at your own risk!. Shake well before using.</div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#intro">1. Introduction</a></span></dt><dt><span class="section"><a href="#Limits">2. Limits</a></span></dt><dt><span class="section"><a href="#LocalTimeSupport">3. Local time support</a></span></dt><dt><span class="section"><a href="#ParsableDateValue">4. Parsable date value</a></span></dt><dt><span class="section"><a href="#ParsableMonthValue">5. Parsable month value</a></span></dt><dt><span class="section"><a href="#date">6. date</a></span></dt><dd><dl><dt><span class="section"><a href="#date-id96473">6.1. Function(s) of date</a></span></dt><dt><span class="section"><a href="#date-id95781">6.2. Method(s) of date</a></span></dt></dl></dd><dt><span class="section"><a href="#dateObject">7. dateObject</a></span></dt><dd><dl><dt><span class="section"><a href="#DaysAndTick">7.1. How Date and Time are stored in <code class="classname">dateObject</code></a></span></dt><dt><span class="section"><a href="#SupportedMetaMethods">7.2. Supported MetaMethods</a></span></dt><dt><span class="section"><a href="#dateObject-id94476">7.3. Method(s) of dateObject</a></span></dt></dl></dd><dt><span class="section"><a href="#history">8. History</a></span></dt><dt><span class="section"><a href="#ackno">9. Acknowledgement</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="intro"></a>1.<2E>Introduction</h2></div></div></div><em class="firstterm">LuaDate</em> is a Lua module for date and time calculation and retrieval using the Gregorian Date system.
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>LuaDate v2</title><link rel="stylesheet" href="main.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.70.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id90891"></a>LuaDate v2</h2></div><div><h3 class="subtitle"><i>Lua Date and Time module for Lua 5.x.</i></h3></div><div><div class="author"><h3 class="author"><span class="firstname">Jas</span> <span class="surname">Latrix</span></h3></div></div><div><p class="copyright">Copyright <20> 2005, 2006 Jas Latrix <code class="email"><<a href="mailto:jastejada@yahoo.com">jastejada@yahoo.com</a>></code></p></div><div><div class="legalnotice"><a name="id349744"></a>All Rights Deserved. Use at your own risk!. Shake well before using.</div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#intro">1. Introduction</a></span></dt><dt><span class="section"><a href="#Limits">2. Limits</a></span></dt><dt><span class="section"><a href="#LocalTimeSupport">3. Local time support</a></span></dt><dt><span class="section"><a href="#ParsableDateValue">4. Parsable date value</a></span></dt><dt><span class="section"><a href="#ParsableMonthValue">5. Parsable month value</a></span></dt><dt><span class="section"><a href="#date">6. date</a></span></dt><dd><dl><dt><span class="section"><a href="#date-id96473">6.1. Function(s) of date</a></span></dt><dt><span class="section"><a href="#date-id95781">6.2. Method(s) of date</a></span></dt></dl></dd><dt><span class="section"><a href="#dateObject">7. dateObject</a></span></dt><dd><dl><dt><span class="section"><a href="#DaysAndTick">7.1. How Date and Time are stored in <code class="classname">dateObject</code></a></span></dt><dt><span class="section"><a href="#SupportedMetaMethods">7.2. Supported MetaMethods</a></span></dt><dt><span class="section"><a href="#dateObject-id94476">7.3. Method(s) of dateObject</a></span></dt></dl></dd><dt><span class="section"><a href="#history">8. History</a></span></dt><dt><span class="section"><a href="#ackno">9. Acknowledgement</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="intro"></a>1.<2E>Introduction</h2></div></div></div><em class="firstterm">LuaDate</em> is a Lua module for date and time calculation and retrieval using the Gregorian Date system.
|
||||||
<p>
|
<p>
|
||||||
To Load the module call <code class="code">require"date"</code> in your script.
|
To Load the module call <code class="code">local date = require"date"</code> in your script.
|
||||||
Make sure Lua can find the source file <code class="filename">date.lua</code>.
|
Make sure Lua can find the source file <code class="filename">date.lua</code>.
|
||||||
A global table called <code class="classname">date</code> will be created.
|
No global table <code class="classname">date</code> will be created.
|
||||||
Use the metamethod <a href="#date.__call">__call</a> to construct a <a href="#dateObject">dateObject</a> see example below:
|
Use the metamethod <a href="#date.__call">__call</a> to construct a <a href="#dateObject">dateObject</a> see example below:
|
||||||
</p><pre class="programlisting">
|
</p><pre class="programlisting">
|
||||||
require "date"
|
local date = require "date"
|
||||||
-- prints all FRIDAY the 13TH dates between year 2000 and 2010
|
-- prints all FRIDAY the 13TH dates between year 2000 and 2010
|
||||||
for i = 2000, 2010 do
|
for i = 2000, 2010 do
|
||||||
-- year jan 1
|
-- year jan 1
|
||||||
|
@@ -6,7 +6,7 @@ arg:
|
|||||||
file - the name of the file to write the generated text calendar
|
file - the name of the file to write the generated text calendar
|
||||||
--]]---------------------
|
--]]---------------------
|
||||||
|
|
||||||
require"date"
|
local date = require"date"
|
||||||
|
|
||||||
function makemonth(y,m)
|
function makemonth(y,m)
|
||||||
local t = {}
|
local t = {}
|
||||||
|
@@ -6,7 +6,7 @@ arg:
|
|||||||
file - the name of the file to write the generated text calendar
|
file - the name of the file to write the generated text calendar
|
||||||
--]]---------------------
|
--]]---------------------
|
||||||
|
|
||||||
require"date"
|
local date = require"date"
|
||||||
|
|
||||||
local htm_foot = [[</body></html>]]
|
local htm_foot = [[</body></html>]]
|
||||||
local htm_head = [[<html><head><style>body{color:#000000;background-color:#FFFFFF;font-family:sans-serif;}th{background:#000000;color:#CCCCCC;vertical-align:middle;}td{vertical-align:top;text-align:center;font-weight:bold;}.s{color:#999999;font-size:60%;}</style></head><body>]]
|
local htm_head = [[<html><head><style>body{color:#000000;background-color:#FFFFFF;font-family:sans-serif;}th{background:#000000;color:#CCCCCC;vertical-align:middle;}td{vertical-align:top;text-align:center;font-weight:bold;}.s{color:#999999;font-size:60%;}</style></head><body>]]
|
||||||
|
Reference in New Issue
Block a user