aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/skang.lua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-03-27 03:01:41 +1000
committerDavid Walter Seikel2014-03-27 03:01:41 +1000
commit9106ee5d97278ce8bbd85b002a8ca213a342b718 (patch)
tree786b841d391459c58dd2ed6447284f65d995ced6 /ClientHamr/GuiLua/skang.lua
parentTODO++ (diff)
downloadSledjHamr-9106ee5d97278ce8bbd85b002a8ca213a342b718.zip
SledjHamr-9106ee5d97278ce8bbd85b002a8ca213a342b718.tar.gz
SledjHamr-9106ee5d97278ce8bbd85b002a8ca213a342b718.tar.bz2
SledjHamr-9106ee5d97278ce8bbd85b002a8ca213a342b718.tar.xz
Proper copyright parsing.
Diffstat (limited to 'ClientHamr/GuiLua/skang.lua')
-rw-r--r--ClientHamr/GuiLua/skang.lua35
1 files changed, 29 insertions, 6 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index 1ed7b90..b11f617 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -62,6 +62,19 @@ things = {}
62Thing = {} 62Thing = {}
63 63
64 64
65-- TODO - This needs to be expanded a bit to cover things like 1.42
66local versions = {
67 '0%.0', 'unwritten', 'Just a stub, no code at all, or completely non-existant.',
68 '0%.1', 'prototype', 'Stuff that has only been prototyped, or partly written. There is some code, and it may even work, but it is not even close to the finished product.',
69 '%d%.3', 'written', 'Stuff that has already been written. It may not be perfect, but it is considered an aproximation of the finished product.',
70 '%d%.5', 'alpha', 'Version being tested by official alpha testers.',
71 '%d%.9', 'beta', 'Version passed alpha testing, but not ready for final release.',
72 '1%.0', 'final', 'Version ready for final release, fully tested.',
73 '3%.0', 'poetry', 'Near perfection has been acheived.',
74 '5%.0', 'nirvana', 'Perfection has been acheived.',
75 '9%.0', 'bible', 'This is the Whord of Ghod.',
76}
77
65-- Trying to capture best practices here for creating modules, especially since module() is broken and deprecated. 78-- Trying to capture best practices here for creating modules, especially since module() is broken and deprecated.
66moduleBegin = function (name, author, copyright, version, timestamp, skin) 79moduleBegin = function (name, author, copyright, version, timestamp, skin)
67 local _M = {} -- This is what we return to require(). 80 local _M = {} -- This is what we return to require().
@@ -89,11 +102,21 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin)
89 _M._NAME = name 102 _M._NAME = name
90 _M._PACKAGE = string.gsub(_M._NAME, "[^.]*$", "") -- Strip the name down to the package name. 103 _M._PACKAGE = string.gsub(_M._NAME, "[^.]*$", "") -- Strip the name down to the package name.
91 104
92 -- TODO - Should parse in an entire copyright message, and strip that down into bits, to put back together. 105 -- Parse in an entire copyright message, and strip that down into bits, to put back together.
93 _M.AUTHOR = author 106 local date, owner = string.match(copyright, '[Cc]opyright (%d%d%d%d) (.*)')
94 _M.COPYRIGHT = copyright .. ' ' .. author 107 _M.AUTHOR = author or owner
95 -- TODO - Translate the version number into a version string. 108 _M.COPYRIGHT = 'Copyright ' .. date .. ' ' .. _M.AUTHOR
96 _M.VERSION = version .. ' lookup version here ' .. timestamp 109 -- Translate the version number into a version string.
110 local versionName, versionDesc = ' ', ''
111 for i = 1, #versions / 3 do
112 if 1 == string.find(version, versions[i]) then
113 versionName = ' ' .. versions[i + 1] .. ' '
114 versionDesc = versions[i + 2]
115 break
116 end
117 end
118 _M.VERSION = version .. versionName .. timestamp
119 _M.VERSION_DESC = versionDesc
97 -- TODO - If there's no skin passed in, try to find the file skin .. '.skang' and load that instead. 120 -- TODO - If there's no skin passed in, try to find the file skin .. '.skang' and load that instead.
98 _M.DEFAULT_SKANG = skin 121 _M.DEFAULT_SKANG = skin
99 122
@@ -123,7 +146,7 @@ moduleEnd = function (module)
123end 146end
124 147
125-- Call this now so that from now on, this is like any other module. 148-- Call this now so that from now on, this is like any other module.
126local _M = moduleBegin('skang', 'David Seikel', '2014', '0.0', '2014-03-19 19:01:00') 149local _M = moduleBegin('skang', 'David Seikel', 'Copyright 2014 David Seikel', '0.1', '2014-03-27 02:57:00')
127 150
128 151
129-- My clever boolean check, this is the third language I've written this in. B-) 152-- My clever boolean check, this is the third language I've written this in. B-)