General > Developers Corner
Passing a table with a value as a table into fancyLog?
VoodooNecro:
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: ----- 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
--- End code ---
An output would look something like:
--- Code: --->Fruits: Apple[1], Banana[3], Corn[0]
--- End code ---
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
--- End quote ---
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
[0] Board index
Go to full version