Itutorial
Excellent OT User
- Joined
- Dec 23, 2014
- Messages
- 2,327
- Solutions
- 68
- Reaction score
- 999
Can someone tell me why this doesn't work?
Game Core
Talkaction
The error
Game Core
Lua:
function Game.logInformation(fileDir, text)
print("Logging -> "..fileDir..": "..text)
local file = io.open (fileDir, "a+")
if not file then print("Could not load file "..fileDir..". Failed to log.") return false end
file:seek("end")
file:write(text)
return true
end
Talkaction
Lua:
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local position = player:getPosition()
local isGhost = not player:isInGhostMode()
player:setGhostMode(isGhost)
if isGhost then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are now invisible.")
position:sendMagicEffect(CONST_ME_YALAHARIGHOST)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are visible again.")
position.x = position.x + 1
position:sendMagicEffect(CONST_ME_SMOKE)
end
Game:logInformation("data/logs/player/"..player:getName()..".txt", "Player used talkaction: /ghost")
return false
end
The error
Code:
data/lib/core/game.lua:71: attempt to concatenate local 'fileDir' (a table value)