Cecho issue

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Cecho issue

Post by tsuujin »

so... I've noticed that if you try to pass cecho along with only the letter "r" it will fail, even if you add color tags to it.

ie
Code: [show] | [select all] lua
cecho("<red>r")
prints nothing
If you change "r" to anything else (that i've tried, at least) it works fine.

so... uh... can we get a fix?

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Cecho issue

Post by Iocun »

Hmm, it works fine for me on Mudlet 1.1.1 on OS X.

I also see nothing in the code in LuaGlobal that might explain why the letter r would be treated specially. Weird.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cecho issue

Post by Vadi »

I have the same issue actually.

heylua cecho("<green>hey")
heylua cecho("<green>hey")
heylua cecho("<red>hey")
heylua cecho("<red>hey")
heylua cecho("<red>hey")
heylua cecho("<red>r")
lua cecho("<red>r")
lua cecho("<red>r")
lua cecho("<red>r")

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Cecho issue

Post by Iocun »

Oh, I realize why it worked for me. I still had my original cecho function in my scripts that replaced the LuaGlobal one. If I remove my script and load LuaGlobal, I have the same problem.

I assume that comes from the reset functionality in xEcho, for which r can be a keyword.
Code: [show] | [select all] lua
for _, v in ipairs(t) do
			if type(v) == 'table' then
				if v.fg then
					local fr, fg, fb = unpack(v.fg)
					if win then setFgColor(win, fr, fg, fb) else setFgColor(fr, fg, fb) end
				end
				if v.bg then
					local br, bg, bb = unpack(v.bg)
					if win then setBgColor(win, br, bg, bb) else setBgColor(br, bg, bb) end
				end
			elseif v == "r" then
				reset()
			else
				if win then out(win, v) else out(v) end
			end
		end

(Note the lines beginning from: elseif v == "r")

So if just the single letter "r" appears in the string portion of your cecho entry, it's misinterpreted as a reset flag and not a string to be echoed.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Cecho issue

Post by tsuujin »

Hmm, who decided that a single letter should be a flag to do something special?

Is there a fix for this, or do I have to go in and just delete that from xEcho?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cecho issue

Post by Vadi »

Could fix it, it's only supposed to work within <> tags

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Cecho issue

Post by tsuujin »

Hmm, I think I'm missing something here...

I go to $home/.config/mudlet and alter the LuaGlobal.lua file. Then I restart Mudlet..... and when I open the LuaGloball.lua again all of my changes have been reverted?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Cecho issue

Post by Heiko »

tsuujin wrote:Hmm, I think I'm missing something here...

I go to $home/.config/mudlet and alter the LuaGlobal.lua file. Then I restart Mudlet..... and when I open the LuaGloball.lua again all of my changes have been reverted?
Yes, you cannot change LuaGlobal.lua. It's being restored on each startup. However, if you want to make changes to LuaGlobal.lua you can do this in your own profile scripts and thus overwrite the respective LuaGlobal code as the profile is being loaded after LuaGlobal.

Denarii
Posts: 111
Joined: Thu Dec 03, 2009 10:54 pm

Re: Cecho issue

Post by Denarii »

It's fixed in my local copy and will be in the next commit for the LuaGlobal repo. I have some other changes to make too, such as fixing the color inserttext functions so they work when the cursor is set manually.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Cecho issue

Post by Vadi »

Thanks :)

Post Reply