Author Topic: Passing a table with a value as a table into fancyLog?  (Read 2225 times)

0 Members and 1 Guest are viewing this topic.

Offline VoodooNecro

  • Newbie
  • *
  • Posts: 3
  • Karma: -1
Passing a table with a value as a table into fancyLog?
« on: October 08, 2015, 02:17:43 PM »
Greetings,

I've recently been working on a command where I need to print a table out silently. However after quite a bit of attempts I can't seem to get it to work (Perhaps fancyLog isn't capable of accepting a table with a value as a table as such?). I couldn't find any documention on the function and had to guess by looking at the code declared in log.lua. Which I admit, I probably did pretty bad at properly reading.  :P

Code: [Select]
-- standard ulx command stuff
local tb =  { }
for _ , v in pairs( player.GetHumans( ) ) do
     table.insert ( tb , {  ["Fruit"] = "Apple" , ["Amount"] = 0 } )
end

ulx.fancyLog(calling_ply, true ,"Fruits:  #s[#i]", tb.Apple, tb.Amount )

--ending ulx command stuff


An output would look something like:

Code: [Select]
>Fruits: Apple[1], Banana[3], Corn[0]


And my lastest attempt with code similar to the example resulted in an error:

Quote

[ERROR] addons/ulx/lua/ulx/log.lua:440: attempt to call method 'gsub' (a nil value)
  1. fancyLogAdmin - addons/ulx/lua/ulx/log.lua:440
   2. fancyLog - addons/ulx/lua/ulx/log.lua:504



Any help would greatly be appreciated. Thanks for your time!

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given