Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Accessing Lua help from Crimson Editor

Accessing Lua help from Crimson Editor

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Tue 16 May 2006 10:36 PM (UTC)
Message
I found this suggestion at:

http://luaboard.sytes.net/index.php?topic=2381.0


It is so useful I decided to reproduce it here. Effectively it will allow you to go directly to a topic in the helpfile when you press F1 if the word the cursor is currently at in the editor is in the helpfile's index, otherwise it will just open the index at the closest word.


  1. In Crimson editor Open Preferences dialog box (Tools -> Preferences) and select User Tools page

  2. Select an empty slot and fill with the following arguments.

    • Menu Text: Lua Context Help
    • Command: C:\your\pathto\Programming in Lua.chm
    • Argument: $(CurrWord)
    • Initial dir: $(FileDir)
    • Hot key: F1
    • Close on exit: Yes
    • Save before execute: No






The post above suggests the help file can be found at:


ftp://ftp.clanwos.org/pub/ebooks/Programming_in_Lua.chm

http://www.plop.nl/lua_tools/Programming_in_Lua.chm

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Norbert   USA  (61 posts)  Bio
Date Reply #1 on Wed 17 May 2006 06:33 AM (UTC)
Message
That's awesome.

Norbert

-Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens
It's a dumb question... skip it.
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 04 Jun 2008 11:24 PM (UTC)

Amended on Wed 04 Jun 2008 11:25 PM (UTC) by Nick Gammon

Message
An alternative approach nowadays is to use the MUSHclient help files, as they include most of the Lua functions, one per page. This doesn't apply to keywords like "function", "for" etc. but usually once you have been programming in Lua for a little while you remember those.

However often you might wonder what is the exact order of arguments to string.find, for example.

To make this work, first we need to let periods be part of a variable name, so that when we put the cursor over string.find for example, it treats it as one word ("string.find") and neither "string" nor "find". That is because string.find is the keyword in the MUSHclient help file.

To do this, edit the file "lua.spc" - usually this would be here:


"C:\Program Files\Crimson Editor\spec\lua.spc"


Near the start is a $DELIMITERS line - we remove the period from the end of it. In fact the whole file should now look like this:


# LUA LANGUAGE SPECIFICATION FILE FOR CRIMSON EDITOR
# FIRST EDITED BY Walter Souto R. Junior (wsouto@bayweb.com.br) 05.11.2002
# UPDATE to Lua 5.0 by Matteo De Simone (matteo.desimone@libero.it) Jun, 16 2003

$CASESENSITIVE=YES
$DELIMITERS=(){}[]<>+-*/%="'~!@#&$^&|\?:;,
$VARIABLEPREFIX=
$ESCAPECHAR=\
$QUOTATIONMARK1="
$QUOTATIONMARK2='
$LINECOMMENT=--
$SHADOWON=[[
$SHADOWOFF=]]
$BLOCKCOMMENTON=--[[
$BLOCKCOMMENTOFF=--]]
$PAIRS1=()
$PAIRS2=[]
$PAIRS3={}
$MULTILINESTRINGCONSTANT=YES



With that done, we can now make F1 bring up the MUSHclient help file:


  1. In Crimson editor Open Preferences dialog box (Tools -> Preferences) and select User Tools page

  2. Select an empty slot (or the one you are using for F1) and fill with the following arguments.

    • Menu Text: MUSHclient Lua Help
    • Command: C:\WINDOWS\winhlp32.exe
    • Argument: -iLUA_$(CurrWord) mushclient.hlp
    • Initial dir: C:\Program Files\MUSHclient
    • Hot key: F1
    • Close on exit: Yes
    • Save before execute: No



If necessary, amend the path names above to reflect your setup. Now you can put the cursor over any standard Lua function (eg. tonumber, or string.match), press F1, and the MUSHclient help information for that function will be shown.

This should be used in conjunction with my other suggestion, which lets you look up MUSHclient internal functions (eg. world.Note):

http://www.gammon.com.au/forum/?id=6579


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,010 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.