# # # patch "lua_hooks.cc" # from [af8016e477fd39f14de53b4c17e16eacb2692bf4] # to [2cea55853bda5f175dc82c227ee21947236327e8] # # patch "std_hooks.lua" # from [602ac070879bb429d902af61e65bcf652857af90] # to [493fc7698a0fbc925814e9e1dfc2edd83e19ec2d] # ============================================================ --- lua_hooks.cc af8016e477fd39f14de53b4c17e16eacb2692bf4 +++ lua_hooks.cc 2cea55853bda5f175dc82c227ee21947236327e8 @@ -600,19 +600,15 @@ bool lua_hooks::hook_hook_wrapper(std::s { Lua ll(st); ll.func("hook_wrapper") - .push_str(func_name) - .push_table(); + .push_str(func_name); - int k=0; for (std::vector::const_iterator i = args.begin(); i != args.end(); ++i) { - ll.push_int(++k) - .push_str(*i) - .set_table(); + ll.push_str(*i); } - ll.call(2, 1); + ll.call(args.size() + 1, 1); ll.extract_str_nolog(out); return ll.ok(); } ============================================================ --- std_hooks.lua 602ac070879bb429d902af61e65bcf652857af90 +++ std_hooks.lua 493fc7698a0fbc925814e9e1dfc2edd83e19ec2d @@ -1188,15 +1188,13 @@ function hook_wrapper(func_name, ...) end function hook_wrapper(func_name, ...) - -- evaluate each single string argument to resolve types - -- like nil's, table's and others - the select('#', ...) syntax is - -- borrowed from http://lua-users.org/wiki/StoringNilsInTables to - -- let this code properly work for nil arguments as well - local args = {n=select('#',...), ...} - for i=2,args.n do + -- we have to ensure that nil arguments are restored properly for the + -- function call, see http://lua-users.org/wiki/StoringNilsInTables + local args = { n=select('#', ...), ... } + for i=1,args.n do args[i] = assert(loadstring("return " .. args[i]))() end - local res = { _G[func_name](unpack(unpack(args, 1, args.n))) } + local res = { _G[func_name](unpack(args, 1, args.n)) } return dump._table(res) end