[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  string.dump - cannot dump functions

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: string.dump - cannot dump functions
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Fiendish   USA  (849 posts)  [Biography] bio   Global Moderator
Date Mon 27 Jun 2011 04:55 AM (UTC)  quote  ]

Amended on Mon 27 Jun 2011 08:13 AM (UTC) by Fiendish

Message
WARNING. If you replace the lua dll with one that is not luajit 2.0, the mapper plugin will fail during backup because it uses FFI. Just, you know, a heads up. Also, performance will suffer.

The new b8 version of luajit supports bytecode dumping and loading, so if you REALLY need to use string.dump just wait a day or so. I'll have the new version up in a snapshot by then. I really doubt you need it, but be happy to know that you'll be able to in the next snapshot.

[EDIT] The new snapshot is up now. https://code.google.com/p/aardwolfclientpackage/downloads/list

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Mon 27 Jun 2011 03:59 AM (UTC)  quote  ]
Message
Hmm. Two things here. First is, this is because you (or Aardwolf) is using LuaJIT. That does not support dumping functions. I finally worked it out after searching for "cannot dump functions" in the source - that message just isn't there.

But if you Google: luajit "cannot dump functions"

... you will find some matches.

One workaround is to put in the "normal" Lua DLL (the one that ships with standard MUSHclient).

Quote:

... when i run this code in http://www.lua.org/cgi-bin/demo, it works fine.. but not in mush ...


That is because Fiendish is using the LuaJIT DLL.


However I really seriously have to wonder why you are dumping functions. I have written many many lines of Lua code, and I never dump them.

I strongly suggest rethinking your design. There should be no need for dumping functions. Perhaps if you describe what you are trying to achieve?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by WinkleWinkle   USA  (5 posts)  [Biography] bio
Date Mon 27 Jun 2011 03:19 AM (UTC)  quote  ]
Message
PS, my test alias looks like this:

<aliases>
<alias
match="__test"
enabled="y"
send_to="12"
sequence="100"
>
<send>function f () print "hello, world" end
s = string.dump (f)
assert (loadstring (s)) () --&gt; hello, world</send>
</alias>
</aliases>


PPS I'm not a new lua coder (using anonymous functions and function pointers before), but i'd be happy if i'm missing soemthing obvious like a requires statement
[Go to top] top

Posted by WinkleWinkle   USA  (5 posts)  [Biography] bio
Date Mon 27 Jun 2011 03:16 AM (UTC)  quote  ]
Message
I'm having huge issues in Aardwolf Mushclient v 1040 with string.dump!

I am using the example script in the help file and I'm getting the same error in my plugin as well as a test alias

Run-time error
World: Aardwolf
Immediate execution
[string "Alias: "]:2: cannot dump functions
stack traceback:
[C]: in function 'dump'
[string "Alias: "]:2: in main chunk


The code I'm using is copied from the help file and it is:

function f () print "hello, world" end
s = string.dump (f)
assert (loadstring (s)) () --> hello, world

Now.. when i run this code in http://www.lua.org/cgi-bin/demo, it works fine.. but not in mush. The whole point of string.dump is to dump functions, why is the error message saying "cannot dump functions" ?

WinkleWinkle
[Go to top] 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.


1,251 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]