-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert IRC colour codes to minetest colour codes. #41
base: master
Are you sure you want to change the base?
Conversation
if chunk == nil then | ||
error(errorval) | ||
end | ||
chunk(ie) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to assert(loadfile(modpath.."/hooks.lua"))(ie)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be split from this commit, IMHO. It's unrelated to the feature being added.
local function convert_colour(text) | ||
local lines = text:split("\3", true) | ||
for index, line in pairs(lines) do | ||
local irc_code = line:match("^(%d+)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block would take e.g. "01foo" at the start of the string as an escape sequence.
@@ -9,14 +9,47 @@ local b64e = ie.require("mime").b64 | |||
irc.hooks = {} | |||
irc.registered_hooks = {} | |||
|
|||
local colour_codes = { | |||
[0] = "white", | |||
[1] = "black", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only really need the index for [0]. The others are auto-numbered starting at 1.
[99] = "#ffffff" | ||
} | ||
|
||
local function convert_colour(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: color
.
ping? |
No description provided.