Jump to content

Module:Kangxi radical

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Remsense (talk | contribs) at 14:49, 11 October 2023. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

require('strict')

local p = {}
local names = {
	[1] = "one",
	[2] = "line",
	[3] = "dot",
	[4] = "slash",
	[5] = "second",
	[6] = "hook",
	[7] = "two",
	[8] = "lid",
	[9] = "man",
	[10] = "legs",
	[11] = "enter",
	[12] = "eight",
	[13] = "down box",
	[14] = "cover",
	[15] = "ice",
	[16] = "table",
	[17] = "open box",
	[18] = "knife",
	[19] = "power",
	[20] = "wrap",
	[21] = "spoon",
	[22] = "right open box",
	[23] = "hiding enclosure",
	[24] = "ten",
	[25] = "divination",
	[26] = "seal",
	[27] = "cliff",
	[28] = "private",
	[29] = "again",
	[30] = "mouth",
	[31] = "enclosure",
	[32] = "earth",
	[33] = "scholar",
	[34] = "go",
	[35] = "go slowly",
	[36] = "evening",
	[37] = "big",
	[38] = "woman",
	[39] = "child",
	[40] = "roof",
	[41] = "inch",
	[42] = "small",
	[43] = "lame",
	[44] = "corpse",
	[45] = "sprout",
	[46] = "mountain",
	[47] = "river",
	[48] = "work",
	[49] = "oneself",
	[50] = "turban",
	[51] = "dry",
	[52] = "short thread",
	[53] = "dotted cliff",
	[54] = "long stride",
	[55] = "two hands",
	[56] = "shoot",
	[57] = "bow",
	[58] = "snout",
	[59] = "bristle",
	[60] = "step",
	[61] = "heart",
	[62] = "halberd",
	[63] = "door",
	[64] = "hand",
	[65] = "branch",
	[66] = "rap",
	[67] = "script",
	[68] = "dipper",
	[69] = "axe",
	[70] = "square",
	[71] = "not",
	[72] = "sun",
	[73] = "say",
	[74] = "moon",
	[75] = "tree",
	[76] = "lack",
	[77] = "stop",
	[78] = "death",
	[79] = "weapon",
	[80] = "do not",
	[81] = "compare",
	[82] = "fur",
	[83] = "clan",
	[84] = "steam",
	[85] = "water",
	[86] = "fire",
	[87] = "claw",
	[88] = "father",
	[89] = "double x",
	[90] = "half tree trunk",
	[91] = "slice",
	[92] = "fang",
	[93] = "cow",
	[94] = "dog",
	[95] = "profound",
	[96] = "jade",
	[97] = "melon",
	[98] = "tile",
	[99] = "sweet",
	[100] = "life",
	[101] = "use",
	[102] = "field",
	[103] = "bolt of cloth",
	[104] = "sickness",
	[105] = "dotted tent",
	[106] = "white",
	[107] = "skin",
	[108] = "dish",
	[109] = "eye",
	[110] = "spear",
	[111] = "arrow",
	[112] = "stone",
	[113] = "spirit",
	[114] = "track",
	[115] = "grain",
	[116] = "cave",
	[117] = "stand",
	[118] = "bamboo",
	[119] = "rice",
	[120] = "silk",
	[121] = "jar",
	[122] = "net",
	[123] = "sheep",
	[124] = "feather",
	[125] = "old",
	[126] = "and",
	[127] = "plow",
	[128] = "ear",
	[129] = "brush",
	[130] = "meat",
	[131] = "minister",
	[132] = "self",
	[133] = "arrive",
	[134] = "mortar",
	[135] = "tongue",
	[136] = "oppose",
	[137] = "boat",
	[138] = "stopping",
	[139] = "color",
	[140] = "grass",
	[141] = "tiger",
	[142] = "insect",
	[143] = "blood",
	[144] = "walk enclosure",
	[145] = "clothes",
	[146] = "west",
	[147] = "see",
	[148] = "horn",
	[149] = "speech",
	[150] = "valley",
	[151] = "bean",
	[152] = "pig",
	[153] = "badger",
	[154] = "shell",
	[155] = "red",
	[156] = "run",
	[157] = "foot",
	[158] = "body",
	[159] = "cart",
	[160] = "bitter",
	[161] = "morning",
	[162] = "walk",
	[163] = "city",
	[164] = "wine",
	[165] = "distinguish",
	[166] = "village",
	[167] = "gold",
	[168] = "long",
	[169] = "gate",
	[170] = "mound",
	[171] = "slave",
	[172] = "short tailed bird",
	[173] = "rain",
	[174] = "blue",
	[175] = "wrong",
	[176] = "face",
	[177] = "leather",
	[178] = "tanned leather",
	[179] = "leek",
	[180] = "sound",
	[181] = "leaf",
	[182] = "wind",
	[183] = "fly",
	[184] = "eat",
	[185] = "head",
	[186] = "fragrant",
	[187] = "horse",
	[188] = "bone",
	[189] = "tall",
	[190] = "hair",
	[191] = "fight",
	[192] = "sacrificial wine",
	[193] = "cauldron",
	[194] = "ghost",
	[195] = "fish",
	[196] = "bird",
	[197] = "salt",
	[198] = "deer",
	[199] = "wheat",
	[200] = "hemp",
	[201] = "yellow",
	[202] = "millet",
	[203] = "black",
	[204] = "embroidery",
	[205] = "frog",
	[206] = "tripod",
	[207] = "drum",
	[208] = "rat",
	[209] = "nose",
	[210] = "even",
	[211] = "tooth",
	[212] = "dragon",
	[213] = "turtle",
	[214] = "flute"
}

function p.Kxr(frame)
	-- simplify handling of args
	local getArgs = require('Module:Arguments').getArgs
	local args = getArgs(frame)
	local r = math.floor(tonumber(args[1]))
	if args[2] then
		error("Only one argument of a number between 1 and 214 is accepted")
	elseif r < 1 or r > 214 then
		error("Argument must be between 1 and 214")
	else
		return p._Kxr(r)
	end
	return
end

function p._Kxr(r)
	local unicode = 0x2F00 + r - 1
	local u_str   = "&#" .. unicode .. ";"
	local result  = u_str
	
	return result
end

return p