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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ 4.99 breaks require "json"

4.99 breaks require "json"

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


Posted by Fiendish   USA  (2,549 posts)  Bio   Global Moderator
Date Wed 28 Oct 2015 12:40 PM (UTC)

Amended on Wed 28 Oct 2015 01:13 PM (UTC) by Fiendish

Message
This seems important.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="TEST"
   author="Fiendish"
   id="111111111111111111111111"
   language="Lua"
   purpose="Load json"
   save_state="y"
   date_written="2015-10-28 14:16:26"
   requires="4.99"
   version="1.0"
>
<description trim="y">
Test description
</description>
</plugin>

<script>
<![CDATA[

require "json"

]]>
</script>
</muclient>



[WARNING] C:\Program Files (x86)\MUSHclient\worlds\plugins\test.xml
Line   20: Error parsing script (Cannot load)
Run-time error
Plugin: TEST (called from world: test)
Immediate execution
...m Files (x86)\MUSHclient\lua\json\decode\strings.lua:90: loop body may accept empty string
stack traceback:
        [C]: ?
        ...m Files (x86)\MUSHclient\lua\json\decode\strings.lua:90: in function 'buildCaptureString'
        ...m Files (x86)\MUSHclient\lua\json\decode\strings.lua:111: in function 'buildCapture'
        ...m Files (x86)\MUSHclient\lua\json\decode\strings.lua:126: in function 'load_types'
        ...:\Program Files (x86)\MUSHclient\lua\json\decode.lua:84: in function 'buildDecoder'
        ...:\Program Files (x86)\MUSHclient\lua\json\decode.lua:97: in main chunk
        [C]: in function 'require'
        C:\Program Files (x86)\MUSHclient\lua\json.lua:5: in main chunk
        [C]: in function 'require'
        [string "Plugin"]:1: in main chunk
[WARNING] C:\Program Files (x86)\MUSHclient\worlds\plugins\test.xml
Line   20: Error parsing script (Cannot load)

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 28 Oct 2015 10:05 PM (UTC)
Message
You didn't need a plugin to prove that. Doing the "require" in an Immediate window triggers it.

It looks like the improvements to LPEG are not compatible with the shipped JSON (luajson).

As a workaround, go to:

https://github.com/harningt/luajson/tree/master

Click the "Download ZIP" button. Unzip and move the files from the "lua" folder into the MUSHclient "lua" directory, overwriting the existing files. In particular you should be replacing these files:


json.lua

Folder: json
  json/encode.lua
  json/util.lua
  json/decode.lua

  Folder: json/decode
    json/decode/composite.lua
    json/decode/number.lua
    json/decode/others.lua
    json/decode/state.lua
    json/decode/strings.lua
    json/decode/util.lua

  Folder: json/encode
    json/encode/array.lua
    json/encode/calls.lua

  Folder: json/encode/number.lua
    json/encode/object.lua
    json/encode/others.lua
    json/encode/output.lua
    json/encode/output_utility.lua
    json/encode/strings.lua


Note that these files are additions, not replacements:


    json/decode/composite.lua
    json/decode/state.lua


A quick test appears to indicate that JSON works now. Please advise if you have issues with it.

- Nick Gammon

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

Posted by Fiendish   USA  (2,549 posts)  Bio   Global Moderator
Date Reply #2 on Thu 29 Oct 2015 11:41 AM (UTC)
Message
Seems to work.
Question: Did the editor always launch on plugin failure to load? It's a bit disruptive, and I don't remember it always happening.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 29 Oct 2015 08:30 PM (UTC)
Message
For quite a while.

http://www.gammon.com.au/scripts/showrelnote.php?version=3.78&productid=0

See point 7.

Quote:

Released on 09 Aug 2006

...


7. In the plugins dialog, if a plugin raises an error when you try to install it (eg. syntax error in a script) then the plugin is automatically opened in the inbuilt notepad, or your designated text editor. This is designed to assist plugin authors fix problems in their plugins.


- Nick Gammon

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

Posted by Fiendish   USA  (2,549 posts)  Bio   Global Moderator
Date Reply #4 on Thu 29 Oct 2015 11:00 PM (UTC)
Message
Huh. I wonder why it feels new. Anyway, the new json seems to work. Probably warrants a 4.100

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 30 Oct 2015 07:42 PM (UTC)
Message
I was going up in 100ths, so I thought the next one would be 5.00. Calling it 4.100 might be confused with 4.10.

- Nick Gammon

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

Posted by Fiendish   USA  (2,549 posts)  Bio   Global Moderator
Date Reply #6 on Fri 30 Oct 2015 09:09 PM (UTC)
Message
I guess.

Maybe it's time to adopt semantic versioning with the new 5.0.0? :)
http://semver.org/

https://github.com/fiendish/aardwolfclientpackage
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.


22,133 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.