Page 2 of 2

Re: Run Lua code from the command line

Posted: Tue Aug 27, 2013 2:02 am
by Akaya
How can I alter this to echo to a miniconsole or label instead of the main window?

Re: Run Lua code from the command line

Posted: Tue Aug 27, 2013 2:12 am
by Vadi
Adjust the display(r) part to an echo - although echoes don't handle tables.

There is a function that'll turn a table into a string you can use, but I can't check that this moment.

Re: Run Lua code from the command line

Posted: Thu Oct 09, 2014 12:42 pm
by Zaphob
So, I love this module ever since I found it back a few years ago. And now it seems, Mudlet 3.0 comes bundled with it already!

My question now: How do you expect the script packages to manage? I would like to include "run lua" for all users 2.1, who don't have it already installed themselves. Of course, if they have it installed, or maybe use 3.0 already, no "run lua" needs to be added anymore.

I was thinking about adding something along these lines, but could not yet test around too much.
Code: [show] | [select all] lua
run-lua-module = run-lua-module or (put all code here somehow)
Maybe there is a preferred solution already?

Earlier, I just shipped 3.0 scripts with "run lua" included, but this made Mudlet run every lua command twice! Then I ditched "run lua" all together, but now 2.1 users can't rely on this luxury.

Re: Run Lua code from the command line

Posted: Thu Oct 09, 2014 8:28 pm
by Vadi
It's already available in 2.1 as well, it gets added by default to new profiles people create. Someone using an existing profile on 3.0 won't have it either - this was in case someone already had it, Mudlet adding it would duplicate it.

There is getModulePriority(), which you could use to see if a module is installed... lua script gets installed as a package though and that doesn't have a corresponding function.

The solution I went with is to have another alias pattern trigger the lua script.

Re: Run Lua code from the command line

Posted: Fri Oct 10, 2014 7:06 pm
by SlySven
There are three modules that get added in auto-magically from the Mudlet "resources" file for all new profiles by the dlgConnectionProfiles::slot_connectToServer() method:
  • deleteOldProfiles.xml
  • echo.xml
  • run-lua-code-v4.xml
Additonally, Aetolia, Achaea, Lusternia, Midkemia and Imperian profiles gain:
  • mudlet-mapper.xml
and 3Scapes and 3Kingdoms profiles get:
  • 3k-mapper.xml