Skip to content

Commit

Permalink
Line ending changes (?????) exposed hook loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
justas-d committed Feb 2, 2017
1 parent dc30071 commit ef6cfeb
Show file tree
Hide file tree
Showing 10 changed files with 1,788 additions and 1,788 deletions.
398 changes: 199 additions & 199 deletions base/Api/ChatConsole.lua

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions base/Api/ConsoleCommand.lua
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
local ConsoleCommand = Api.class("ConsoleCommand")

--[[ ---------------------------------------------------------------------------------------
Name: initialize
Desc: Constructs new unregistered console command.
Args:
(string trigger) - the string that triggers the command.
(string description) - a short description of what the command does.
(ModHandle modHandle) - a reference to the mod, which owns this command.
(function callback) - the function, which will be called when this command
is executed.
Signature: (string trigger) - same as trigger
(string input) - everything, in the input
string, past the trigger
--]] ---------------------------------------------------------------------------------------
function ConsoleCommand:initialize(trigger, description, modHandle, callback)
assert_e(Api.IsString(trigger))
assert_e(Api.IsString(description))
assert_e(Api.IsTable(modHandle))
assert_e(Api.IsFunction(callback))

self._trigger = trigger
self._description = description
self._modHandle = modHandle
self._callback = callback

getmetatable(self).__tojson = function(s, state)
return "{" .. "\"trigger\": \"" .. tostring(s:GetTrigger()) .. "\"," ..
"\"description\": \"" .. tostring(s:GetDescription()) .. "\"," ..
"\"modHandle\": \"" .. tostring(s:GetModHandle()) .. "\"," ..
"\"callback\": \"" .. tostring(s:GetCallback()) .. "\"}"
end
end

function ConsoleCommand:GetTrigger() return self._trigger end

function ConsoleCommand:GetDescription() return self._description end

function ConsoleCommand:GetModHandle() return self._modHandle end

function ConsoleCommand:GetCallback() return self._callback end

local ConsoleCommand = Api.class("ConsoleCommand")

--[[ ---------------------------------------------------------------------------------------
Name: initialize
Desc: Constructs new unregistered console command.
Args:
(string trigger) - the string that triggers the command.
(string description) - a short description of what the command does.
(ModHandle modHandle) - a reference to the mod, which owns this command.
(function callback) - the function, which will be called when this command
is executed.
Signature: (string trigger) - same as trigger
(string input) - everything, in the input
string, past the trigger
--]] ---------------------------------------------------------------------------------------
function ConsoleCommand:initialize(trigger, description, modHandle, callback)
assert_e(Api.IsString(trigger))
assert_e(Api.IsString(description))
assert_e(Api.IsTable(modHandle))
assert_e(Api.IsFunction(callback))

self._trigger = trigger
self._description = description
self._modHandle = modHandle
self._callback = callback

getmetatable(self).__tojson = function(s, state)
return "{" .. "\"trigger\": \"" .. tostring(s:GetTrigger()) .. "\"," ..
"\"description\": \"" .. tostring(s:GetDescription()) .. "\"," ..
"\"modHandle\": \"" .. tostring(s:GetModHandle()) .. "\"," ..
"\"callback\": \"" .. tostring(s:GetCallback()) .. "\"}"
end
end

function ConsoleCommand:GetTrigger() return self._trigger end

function ConsoleCommand:GetDescription() return self._description end

function ConsoleCommand:GetModHandle() return self._modHandle end

function ConsoleCommand:GetCallback() return self._callback end

return ConsoleCommand
42 changes: 21 additions & 21 deletions base/Internal/PostPlay.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Log.Debug("Called PostPlay.lua")

-- notify player of any failed mod loads

local configError = Api.ModManager:GetLoadConfigError()
local modLoadErrors = Api.ModManager:GetLoadModsError()

local function writeChat(message)
Api.ChatConsole.SendLocalChat(message, true, false, "VermHook: ")
end

if configError then
writeChat("Error loading config: " .. tostring(configError))
end

if modLoadErrors then
writeChat("Errors loading mods:")

for k,v in pairs(modLoadErrors) do
writeChat(tostring(k) .. ": " .. tostring(v))
end
Log.Debug("Called PostPlay.lua")

-- notify player of any failed mod loads

local configError = Api.ModManager:GetLoadConfigError()
local modLoadErrors = Api.ModManager:GetLoadModsError()

local function writeChat(message)
Api.ChatConsole.SendLocalChat(message, true, false, "VermHook: ")
end

if configError then
writeChat("Error loading config: " .. tostring(configError))
end

if modLoadErrors then
writeChat("Errors loading mods:")

for k,v in pairs(modLoadErrors) do
writeChat(tostring(k) .. ": " .. tostring(v))
end
end
Loading

0 comments on commit ef6cfeb

Please sign in to comment.