Hello. I've been trying to get an old plugin I found here to work with "special" characters. In the MUD I play there's an area that has a type of hieroglyph that you have to learn to translate. Instead of using a key to manually translate each and every time I was hoping to have a script convert it.
I've been trying to use the Lua script found here:
http://www.gammon.com.au/forum/?id=8747&reply=4#reply4
I would want \:\ to convert to the letter S, for example.
However the characters I want it to match are "symbols" like \:\ and -:-, etc. Every time I try to match these I get different types of errors when putting \:\ in quotes or double brackets [[]]. I don't know enough to escape the special characters or whatever needs to be done. Trying to put an extra \ before each symbol will throw another error as well.
An example error would be : [string "Plugin: Convert_Word"]:3: '}' expected (to close '{' at line 1) near '='
Any help with this would be greatly appreciated.
I've been trying to use the Lua script found here:
http://www.gammon.com.au/forum/?id=8747&reply=4#reply4
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Convert_Word"
author="Nick Gammon"
id="9c0ed228bdb4a71c77e85ce0"
language="Lua"
purpose="Converts one word to another"
date_written="2008-06-29"
requires="4.00"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
conversions = {
foo = "bar",
dog = "cat",
horse = "donkey",
-- add more here
}
function OnPluginPacketReceived (s)
return (string.gsub (s, "%a+", conversions))
end -- function OnPluginPacketReceived
</script>
</muclient>
I would want \:\ to convert to the letter S, for example.
However the characters I want it to match are "symbols" like \:\ and -:-, etc. Every time I try to match these I get different types of errors when putting \:\ in quotes or double brackets [[]]. I don't know enough to escape the special characters or whatever needs to be done. Trying to put an extra \ before each symbol will throw another error as well.
An example error would be : [string "Plugin: Convert_Word"]:3: '}' expected (to close '{' at line 1) near '='
Any help with this would be greatly appreciated.