Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

red-001
Copy link
Member

@red-001 red-001 commented May 4, 2017

No description provided.

@kaeza kaeza self-assigned this May 4, 2017
if chunk == nil then
error(errorval)
end
chunk(ie)
Copy link
Member

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).

Copy link
Member

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+)")
Copy link
Member

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",
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: color.

@sofar
Copy link
Member

sofar commented Oct 3, 2017

This seems worth merging, perhaps @kaeza can fix-on-merge or @red-001 red-001 can refresh this?

@sofar
Copy link
Member

sofar commented Apr 24, 2018

ping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants