I have a fairly simple nested table Aurora64.Chat
containing a couple of functions (where the main Aurora64
class is initialized elsewhere but I inserted it here for completeness):
Aurora64 = {};
Aurora64.Chat = {
entityId = 0;
Init = function()
local entity; --Big long table here.
if (g_gameRules.class == "InstantAction") then
g_gameRules.game:SetTeam(3, entity.id); --Spectator, aka neutral.
end
entityId = Entity.id;
self:LogToSystem("Created chat entity '" .. entity.name .. "' with ID '" .. entity.id .. "'. It is now available for use.");
end
LogToSystem = function(msg)
System.LogAlways("$1[Aurora 64]$2 " .. msg);
end
}
The above code fails (checked with the Lua Demo) with the following:
input:14: '}' expected (to close '{' at line 3) near 'LogToSystem'
I have tracked it down to the LogToSystem
function and its usage (if I remove the function and the one time it is used, the code compiles perfectly), and I thought it was to do with my use of use of concatenation (it wasn't).
I'm thinking I might have missed something simple, but I checked the documentation on functions and the function & its call seem to be written properly.
What exactly am I doing wrong here?