Lava Titan
Developer
hey, I created this function to use on donation items for example, and create few lines in a log file with details of usage
and seems I'm missing something cuz getting an error that I'm not able to understand
compat.lua
actionscript.lua
error in console:
Thanks in advance
and seems I'm missing something cuz getting an error that I'm not able to understand
compat.lua
Code:
function logItemUsage(playerId, itemId, directory)
local log_str=""
local player = Player(playerId)
local item = ItemType(itemId)
log_str = "Player Name: "..player:getName().."\nItem ID: "..item:getId().."\nItem Name: "..item:getName()..""
if log_str ~= "" then
local file = io.open(directory, "a+")
file:write("------------------------------------------------------------\nDay: " .. os.date("%d/%m/%Y") .. "\nTime: " .. os.date("%H:%M:%S") .. "\n"..log_str.."\n------------------------------------------------------------\n")
file:close()
end
return true
end
actionscript.lua
Code:
logItemUsage(player:getId(), item:getId(), 'data/items.log')
error in console:
Thanks in advance
Last edited: