[ZeroBrane Studio] Re: error loading module 'socket.core'

  • From: "Steve Russell" <steve.russell@xxxxxxxxxxxxxxxxxxxxx>
  • To: <zerobrane@xxxxxxxxxxxxx>
  • Date: Fri, 12 Sep 2014 09:39:39 +0100

Hi Paul,

That works great.  I'll try to migrate that working debug setup to work with my 
application now.

Many thanks so far.

Steve

-----Original Message-----
From: zerobrane-bounce@xxxxxxxxxxxxx [mailto:zerobrane-bounce@xxxxxxxxxxxxx] On 
Behalf Of Paul K
Sent: 12 September 2014 06:03
To: zerobrane@xxxxxxxxxxxxx
Subject: [ZeroBrane Studio] Re: error loading module 'socket.core'

Hi Steve,

> C:\Program Files (x86)\Wireshark>tshark -X lua_script:test.lua
> tshark: Lua: Error during loading:
>  ...rg\Desktop\ZeroBraneStudio\lualibs/mobdebug/mobdebug.lua:139: bad 
> argument #1 to 'pairs' (table expected, got function)

I got the latest wireshark to check what may be going on. It turned out that 
since the wireshark is now using Lua 5.2, my workaround for "fixing" debug 
table is not working anymore (for some reason wireshark has function "debug" 
where the applications expect to have "table"
debug, hence the error you see).

For Lua 5.2 you need to use "_G.debug = require('debug')" as the first line in 
your script, which "fixed" the debug tabel. If you need to log messages, then 
do something like this:

local log = debug
_G.debug = require('debug')
require("mobdebug").start()
print("Hello!")
print("World!")
log("my log message")

I tested with the following batch script (I think it matches yours) and 
everything appears to work:

set ZBS=D:\users\paul\ZeroBraneStudio
set LUA_PATH=.\?.lua;%ZBS%\lualibs/?/?.lua;%ZBS%\lualibs/?.lua
set LUA_CPATH=%ZBS%\bin/?.dll;%ZBS%\bin/clibs52/?.dll
tshark -X lua_script:test.lua

I'll update the blog post [1] to mention this.

Paul.

[1] 
http://notebook.kulchenko.com/zerobrane/debugging-wireshark-lua-scripts-with-zerobrane-studio


Other related posts: