 |
jthomas Newbie
Joined: 23 Oct 2016 Posts: 5
|
Posted: Sun Jun 24, 2018 1:34 am
using lua to redirect output to a specific window |
Using zscript you can just #win Chat @chatstring
but I can't figure out how to do it from lua, zs.window() fails to do anything.
I also can't figure out how to use the gag command in lua.
Any suggestions? |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 3861 Location: Pensacola, FL, USA
|
Posted: Sun Jun 24, 2018 2:06 pm |
Is there a reason you need to be able to do it from lua?
Just to see if you can?
CMUD being able to use other languages was a rather niche idea, fun in theory, but i'm not sure how practical it would be in every circumstance.
They might be able to, but I don't know lua that well.
I would suggest #CATURE and #GAGing with zScript, then stick the stuff that is easier to manipulate with lua inside a #LUA command if both need to be done in the same trigger. |
|
_________________ Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34 |
|
|
 |
jthomas Newbie
Joined: 23 Oct 2016 Posts: 5
|
Posted: Sat Jun 30, 2018 2:11 am |
sorry for the long delay, the reason is because lua is just better for scripting. My main issue currently is that lua formatting output is very easy with string.format following most of the rules for printf from C, which is super easy. However, when I try to just save from lua to zscript my nicely formatted output with %ansi in it to make it pretty colors, somewhere in storing the lua string into a zs.var.this_string the white spaces get stripped out :(. and because lua can't print to other windows (that I can find), i'm forced to use zscript for this and gagging.
%format() does a similar job as the lua string.format, except there's no modifier I can find to force showing a + sign if the number is positive. it's not the end of the world, but it's not what I wanted. |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 3861 Location: Pensacola, FL, USA
|
Posted: Sat Jun 30, 2018 6:40 am |
You could always use MXP style color instead of ansi, that might save better.
#SAY {<color red yellow>test</color>} |
|
_________________ Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34 |
|
|
 |
|
|