Module:Calendar/shaacamthanj: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
m added digits
wip
Line 1: Line 1:
local calendar = {}
local calendar = {}
local epoch_date = 0 -- TO FIX, datestamp for Casting Rains
local subdigits = {[0] = '', '', '','','','','','',}
local natdigits = {[0] = '', '', '', '', '', ''}
local subseparators = {'', '', '', '󰴂'}
local natseparators = {'', '', '', ''}


local daynames = {
local daynames = {
Line 7: Line 14:


local monthnames = {
local monthnames = {
eng = {'the Depths', 'the Casting Rains', 'Hunger', 'Hunting', 'Floods', 'Light', 'Storms', 'Forage', 'Bloods', 'Harvest', 'Drought', 'the Dry Season Solstice', 'Decay', 'Lanterns'},
eng = {[0] = 'the Depths', 'the Casting Rains', 'Hunger', 'Hunting', 'Floods', 'Light', 'Storms', 'Forage', 'Bloods', 'Harvest', 'Drought', 'the Dry Season Solstice', 'Decay', 'Lanterns'},
scs = {'', '', '', '', '', '', '', '', '', '', '', '', '', ''}
scs = {[0] = '', '', '', '', '', '', '', '', '', '', '', '', '', ''}
}
 
local weeknames = {
eng = {'Quiet Week', 'Unlucky Week', 'Lucky Week', 'Nightly Week'},
scs = {'QUIET WEEK', 'Unlucky Week', 'Lucky Week', 'Nightly Week'},
}
}




local function substrate_num(num)
local function substrate_num(num)
local placemarker = {[0] = '', '', '','','','','','',''}
--- Digits in the subtrate system
local place = 0
local digits = { subdigits[num % 8] }
num = math.floor(num / 8)
while num > 0 do
place = place + 1
local d = num % 6
if d ~= 0 then
digits[#digits+1] = subseparators[place]
if d ~= 1 then digits[#digits+1] = natdigits[d] end
end
num = math.floor(num / 6)
end
end
return '' .. table.concat(digits)
end
local function native_num(num)
--- Digits in the subtrate system
local place = 0
local digits = { natdigits[num % 6] }
num = math.floor(num / 6)
while num > 0 do
place = place + 1
local d = num % 6
if d ~= 0 then
digits[#digits+1] = natseparators[place]
if d ~= 1 then digits[#digits+1] = natdigits[d] end
end
num = math.floor(num / 6)
end
return '' .. table.concat(digits)
end
return calendar

Revision as of 14:07, 17 November 2026

Documentation for this module may be created at Module:Calendar/shaacamthanj/doc

local calendar = {}

local epoch_date = 0 -- TO FIX, datestamp for Casting Rains 

local subdigits = {[0] = '', '', '','','','','','',}
local natdigits = {[0] = '', '', '', '', '', ''}
local subseparators = {'', '', '', '󰴂'}
local natseparators = {'', '', '', ''}

local daynames = {
eng = {'1', '2', '3', '4', '5', '6', '7', '8'},
scs = {'', '', '', '', '', '', '', ''}
}

local monthnames = {
eng = {[0] = 'the Depths', 'the Casting Rains', 'Hunger', 'Hunting', 'Floods', 'Light', 'Storms', 'Forage', 'Bloods', 'Harvest', 'Drought', 'the Dry Season Solstice', 'Decay', 'Lanterns'},
scs = {[0] = '', '', '', '', '', '', '', '', '', '', '', '', '', ''}
}

local weeknames = {
	eng = {'Quiet Week', 'Unlucky Week', 'Lucky Week', 'Nightly Week'},
	scs = {'QUIET WEEK', 'Unlucky Week', 'Lucky Week', 'Nightly Week'},
}


local function substrate_num(num)
	--- Digits in the subtrate system
	local place = 0
	local digits = { subdigits[num % 8] }
	num = math.floor(num / 8)
	while num > 0 do
		place = place + 1
		local d = num % 6
		if d ~= 0 then
			digits[#digits+1] = subseparators[place]
			if d ~= 1 then digits[#digits+1] = natdigits[d] end
		end
		num = math.floor(num / 6)
	end
	return '' .. table.concat(digits)
end

local function native_num(num)
	--- Digits in the subtrate system
	local place = 0
	local digits = { natdigits[num % 6] }
	num = math.floor(num / 6)
	while num > 0 do
		place = place + 1
		local d = num % 6
		if d ~= 0 then
			digits[#digits+1] = natseparators[place]
			if d ~= 1 then digits[#digits+1] = natdigits[d] end
		end
		num = math.floor(num / 6)
	end
	return '' .. table.concat(digits)
end

return calendar