This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Lua format string | |
-- @param text text | |
-- @param args table | |
local function fstring(text, args) | |
local res, _ = string.gsub(text, '%${([%w_]+)}', args) | |
return res | |
end | |
-- Example | |
--[[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Format table: | |
-- unicode.blocks = { | |
-- ['Domino-Tiles'] = "\u{1F030}-\u{1F09F}", | |
-- ['Supplemental-Arrows-C'] = "\u{1F800}-\\u{1F8FF}", | |
-- ... | |
-- } | |
-- | |
-- Blocks.txt = https://www.unicode.org/Public/UNIDATA/Blocks.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
-- @function switch | |
-- @param value value | |
-- @param t table | |
-- @return nil or value | |
local function switch(value, t) | |
assert(type(t) == 'table', 'Argument[2] must be a table') | |
if t[value] then | |
assert(type(t[value]) == 'function', 'Case action must be a function') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
####--------------------------------#### | |
#--# Author: by uriid1 #--# | |
#--# License: GNU GPLv3 #--# | |
####--------------------------------#### | |
--]] | |
local M = {} | |
function M.decToHex(decimal) |