diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index f61374407..ece4722d3 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -1434,7 +1434,7 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3");
SetItemRotation = { Params = "ItemRotation", Return = "", Notes = "Set the rotation from the item in the frame" },
},
},
-
+
cItemGrid =
{
diff --git a/Server/Plugins/APIDump/Classes/Network.lua b/Server/Plugins/APIDump/Classes/Network.lua
index e517b8022..1b102a422 100644
--- a/Server/Plugins/APIDump/Classes/Network.lua
+++ b/Server/Plugins/APIDump/Classes/Network.lua
@@ -48,7 +48,7 @@ local LinkCallbacks =
-- Not used for incoming server links
-- All returned values are ignored
end,
-
+
OnError = function ({{cTCPLink|a_TCPLink}}, a_ErrorCode, a_ErrorMsg)
-- The specified error has occured on the {{cTCPLink|link}}
-- No other callback will be called for this link from now on
@@ -56,14 +56,14 @@ local LinkCallbacks =
-- It is an Undefined Behavior to send data to a_TCPLink in or after this callback
-- All returned values are ignored
end,
-
+
OnReceivedData = function ({{cTCPLink|a_TCPLink}}, a_Data)
-- Data has been received on the {{cTCPLink|link}}
-- Will get called whenever there's new data on the {{cTCPLink|link}}
-- a_Data contains the raw received data, as a string
-- All returned values are ignored
end,
-
+
OnRemoteClosed = function ({{cTCPLink|a_TCPLink}})
-- The remote peer has closed the {{cTCPLink|link}}
-- The link is already closed, any data sent to it now will be lost
@@ -109,7 +109,7 @@ local ListenCallbacks =
-- It is safe to send data to the link now
-- All returned values are ignored
end,
-
+
OnError = function (a_ErrorCode, a_ErrorMsg)
-- The specified error has occured while trying to listen
-- No other callback will be called for this server handle from now on
@@ -146,7 +146,7 @@ local UDPCallbacks =
]],
},
-
+
{
Header = "Example client connection",
Contents =
@@ -168,17 +168,17 @@ local ConnectCallbacks =
-- Connection succeeded, send the http request:
a_Link:Send("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n")
end,
-
+
OnError = function (a_Link, a_ErrorCode, a_ErrorMsg)
-- Log the error to console:
LOG("An error has occurred while talking to google.com: " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")")
end,
-
+
OnReceivedData = function (a_Link, a_Data)
-- Log the received data to console:
LOG("Incoming http data:\r\n" .. a_Data)
end,
-
+
OnRemoteClosed = function (a_Link)
-- Log the event into the console:
LOG("Connection to www.google.com closed")
@@ -195,7 +195,7 @@ end
]],
},
-
+
{
Header = "Example server implementation",
Contents =
@@ -225,18 +225,18 @@ local EchoLinkCallbacks =
-- This will not be called for a server connection, ever
assert(false, "Unexpected Connect callback call")
end,
-
+
OnError = function (a_Link, a_ErrorCode, a_ErrorMsg)
-- Log the error to console:
local RemoteName = "'" .. a_Link:GetRemoteIP() .. ":" .. a_Link:GetRemotePort() .. "'"
LOG("An error has occurred while talking to " .. RemoteName .. ": " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")")
end,
-
+
OnReceivedData = function (a_Link, a_Data)
-- Send the received data back to the remote peer
a_Link:Send(Data)
end,
-
+
OnRemoteClosed = function (a_Link)
-- Log the event into the console:
local RemoteName = "'" .. a_Link:GetRemoteIP() .. ":" .. a_Link:GetRemotePort() .. "'"
@@ -251,7 +251,7 @@ local ListenCallbacks =
-- No processing needed, just log that this happened:
LOG("OnAccepted callback called")
end,
-
+
OnError = function (a_ErrorCode, a_ErrorMsg)
-- An error has occured while listening for incoming connections, log it:
LOG("Cannot listen, error " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")"
@@ -284,7 +284,7 @@ g_Server = nil
]],
},
}, -- AdditionalInfo
-
+
Functions =
{
Connect = { Params = "Host, Port, LinkCallbacks", Return = "bool", IsStatic = true, Notes = "Begins establishing a (client) TCP connection to the specified host. Uses the LinkCallbacks table to report progress, success, errors and incoming data. Returns false if it fails immediately (bad port value, bad hostname format), true otherwise. Host can be either an IP address or a hostname." },
@@ -306,7 +306,7 @@ g_Server = nil
Note that when Lua garbage-collects this class, the listening socket is closed. Therefore the plugin
should keep it referenced in a global variable for as long as it wants the server running.
]],
-
+
Functions =
{
Close = { Params = "", Return = "", Notes = "Closes the listening socket. No more connections will be accepted, and all current connections will be closed." },
@@ -332,7 +332,7 @@ g_Server = nil
network. Note that calling Send() before the TLS handshake finishes is supported, but the data is
queued internally and only sent once the TLS handshake is completed.
]],
-
+
Functions =
{
Close = { Params = "", Return = "", Notes = "Closes the link forcefully (TCP RST). There's no guarantee that the last sent data is even being delivered. See also the Shutdown() method." },
@@ -355,7 +355,7 @@ g_Server = nil
Note that when Lua garbage-collects this class, the listening socket is closed. Therefore the plugin should keep this object referenced in a global variable for as long as it wants the endpoint open.
]],
-
+
Functions =
{
Close = { Params = "", Return = "", Notes = "Closes the UDP endpoint. No more datagrams will be reported through the callbacks, the UDP port will be closed." },
@@ -365,8 +365,8 @@ g_Server = nil
Send = { Params = "RawData, RemoteHost, RemotePort", Return = "bool", Notes = "Sends the specified raw data (string) to the specified remote host. The RemoteHost can be either a hostname or an IP address; if it is a hostname, the endpoint will queue a DNS lookup first, if it is an IP address, the send operation is executed immediately. Returns true if there was no immediate error, false on any failure. Note that the return value needn't represent whether the packet was actually sent, only if it was successfully queued." },
},
}, -- cUDPEndpoint
-
-
+
+
cUrlClient =
{
Desc =
@@ -391,7 +391,7 @@ g_Server = nil
POST and PUT requests), and an Options parameter specifying additional options specific to the protocol
used.
]],
-
+
AdditionalInfo =
{
{
@@ -457,7 +457,7 @@ function HandleConsoleDownload(a_Split) -- Console command handler
if (not(url) or not(fnam)) then
return true, "Missing parameters. Usage: download "
end
-
+
-- Define the cUrlClient callbacks
local callbacks =
{
@@ -481,7 +481,7 @@ function HandleConsoleDownload(a_Split) -- Console command handler
self.m_File:write(a_Data)
end
end,
-
+
OnBodyFinished = function (self)
-- If the file has been opened, close it and report success
if (self.m_File) then
@@ -490,7 +490,7 @@ function HandleConsoleDownload(a_Split) -- Console command handler
end
end,
}
-
+
-- Start the URL download:
local isSuccess, msg = cUrlClient:Get(url, callbacks)
if not(isSuccess) then
@@ -527,7 +527,7 @@ end
]],
},
},
-
+
Functions =
{
Delete = { Params = "URL, Callbacks, [Headers], [RequestBody], [Options]", Return = "bool, [ErrMsg]", IsStatic = true, Notes = "Starts a HTTP DELETE request. Alias for Request(\"DELETE\", ...). Returns true on succes, false and error message on immediate failure (unparsable URL etc.)."},
diff --git a/Server/Plugins/APIDump/Classes/Plugins.lua b/Server/Plugins/APIDump/Classes/Plugins.lua
index 99262b9cd..d813f8f0d 100644
--- a/Server/Plugins/APIDump/Classes/Plugins.lua
+++ b/Server/Plugins/APIDump/Classes/Plugins.lua
@@ -176,14 +176,14 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
HOOK_WEATHER_CHANGING = { Notes = "Called just before the weather changes" },
HOOK_WORLD_STARTED = { Notes = "Called when a world has been started." },
HOOK_WORLD_TICK = { Notes = "Called in each world's tick thread when the game logic is about to tick (20 times a second)." },
-
+
psDisabled = { Notes = "The plugin is not enabled in settings.ini" },
psError = { Notes = "The plugin is enabled in settings.ini, but it has run into an error while loading. Use {{cPlugin}}:GetLoadError() to identify the error." },
psLoaded = { Notes = "The plugin is enabled and loaded." },
psNotFound = { Notes = "The plugin has been loaded, but is no longer present on disk." },
psUnloaded = { Notes = "The plugin is enabled in settings.ini, but it has been unloaded (by a command)." },
}, -- constants
-
+
ConstantGroups =
{
Hooks =
diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua
index df479a634..4bea64435 100644
--- a/src/Bindings/BindingsProcessor.lua
+++ b/src/Bindings/BindingsProcessor.lua
@@ -25,7 +25,7 @@ Placeholders in use (i = internal ToLua++):
- \3 and \4: (i) Embedded C code ("<>")
- \5 and \6: (i) Embedded C code ("{}")
- \17 and \18: DoxyComment for next item ("/** ... */") via an ID lookup
- - \19 and \20: DocyComment for previous item ("///< ... \n") via an ID lookup
+ - \19 and \20: DoxyComment for previous item ("///< ... \n") via an ID lookup
--]]
@@ -121,7 +121,7 @@ function parser_hook(a_Code)
return strsub(a_Code, e) -- normally we would use 'e + 1', but we need to preserve the [^:]
end
end
-
+
-- Process forward DoxyComments:
do
local b, e, comment = a_Code:find("^%s*(%b\17\18)")
@@ -135,7 +135,7 @@ function parser_hook(a_Code)
return strsub(a_Code, e + 1)
end
end
-
+
-- Process backward DoxyComments:
do
local b, e, comment = a_Code:find("^%s*(%b\19\20)")
@@ -200,7 +200,7 @@ local function OutputLuaStateHelpers(a_Package)
f:write("\n\n\n\n\n")
f:close()
end
-
+
-- Output the Push() and GetStackValue() function declarations:
do
local f = assert(io.open("LuaState_Declaration.inc", "w"))
@@ -342,12 +342,12 @@ local function outputClassFunctionDocs(a_File, a_Class, a_Functions)
return (a_Fn1.Name < a_Fn2.Name)
end
)
-
+
-- If there are no functions, bail out:
if not(functions[1]) then
return
end
-
+
-- Output the descriptions:
a_File:write("\t\tFunctions =\n\t\t{\n")
for _, fn in ipairs(functions) do
@@ -401,12 +401,12 @@ local function outputClassVariableDocs(a_File, a_Class, a_Variables)
return (a_Var1.Name < a_Var2.Name)
end
)
-
+
-- If there are no variables, bail out:
if not(variables[1]) then
return
end
-
+
-- Output the descriptions:
a_File:write("\t\tVariables =\n\t\t{\n")
for _, v in ipairs(variables) do
@@ -442,12 +442,12 @@ local function outputClassConstantDocs(a_File, a_Class, a_Constants, a_IgnoredCo
return (a_Var1.Name < a_Var2.Name)
end
)
-
+
-- If there are no constants, bail out:
if not(constants[1]) then
return
end
-
+
-- Output the descriptions:
a_File:write("\t\tConstants =\n\t\t{\n")
for _, con in ipairs(constants) do
@@ -474,14 +474,14 @@ local function outputClassEnumDocs(a_File, a_Class, a_Enums)
if (not(a_Enums) or not(a_Enums[1])) then
return
end
-
+
-- Sort the enums by name:
table.sort(a_Enums,
function (a_Enum1, a_Enum2)
return (a_Enum1.name < a_Enum2.name)
end
)
-
+
-- Output the enums:
a_File:write("\t\tEnums =\n\t\t{\n")
for i, enum in ipairs(a_Enums) do
@@ -540,7 +540,7 @@ local function outputClassDocs(a_Class, a_Functions, a_Variables, a_Constants, a
if (a_Class.DoxyComment) then
f:write("\t\tDesc = ", string.format("%q", a_Class.DoxyComment), ",\n")
end
-
+
-- If the class inherits from anything, output it here:
local ignoredConstants = {}
if (a_Class.base and (a_Class.base ~= "")) then
@@ -559,19 +559,19 @@ local function outputClassDocs(a_Class, a_Functions, a_Variables, a_Constants, a
end
f:write("\t\t},\n")
end
-
+
-- Output the functions:
outputClassFunctionDocs(f, a_Class, a_Functions)
-
+
-- Output the variables:
outputClassVariableDocs(f, a_Class, a_Variables)
-
+
-- Output the constants:
outputClassConstantDocs(f, a_Class, a_Constants, ignoredConstants)
-
+
-- Output the enums:
outputClassEnumDocs(f, a_Class, a_Class.enums)
-
+
-- Output the footer:
f:write("\t},\n}\n")
f:close()
@@ -616,7 +616,7 @@ local function genPackageDocs(a_Self)
f:close()
end
end
-
+
applyNextDoxyComments(a_Self)
-- Generate docs for each member:
@@ -631,7 +631,7 @@ local function genPackageDocs(a_Self)
end
i = i + 1
end
-
+
-- Output the globals' docs:
local functions = {}
local variables = {}
@@ -646,7 +646,7 @@ local function genPackageDocs(a_Self)
a_Self.lname = "Globals"
outputClassDocs(a_Self, functions, variables, constants, filenames)
a_Self.lname = oldName
-
+
-- Output the list of docs files:
table.sort(filenames)
local f = assert(io.open("docs/_files.lua", "w"))
@@ -686,7 +686,7 @@ local function genClassDocs(a_Self, a_Filenames)
end
i = i + 1
end
-
+
-- Output the individual docs
outputClassDocs(a_Self, functions, variables, constants, a_Filenames)
end
@@ -706,7 +706,7 @@ local function parseFunctionParameters(a_Function)
) then
return {}
end
-
+
local res = {}
local idx = 1
for _, param in ipairs(a_Function.args or {}) do
@@ -751,7 +751,7 @@ end
local function genFunctionMemberDocs(a_Self, a_Functions, a_Variables, a_Constants)
assert(a_Self.lname)
-
+
local fn = a_Functions[a_Self.lname] or {}
a_Functions[a_Self.lname] = fn
@@ -776,14 +776,14 @@ end
local function genVariableMemberDocs(a_Self, a_Functions, a_Variables, a_Constants)
assert(a_Self.lname)
-
+
local desc =
{
Name = a_Self.lname,
Type = a_Self.type,
DoxyComment = a_Self.DoxyComment,
}
-
+
if (string.find(a_Self.type,'const%s+') or string.find(a_Self.mod, 'tolua_readonly') or string.find(a_Self.mod, 'tolua_inherits')) then
a_Constants[a_Self.lname] = desc
else
@@ -806,7 +806,7 @@ local function generateDocs(a_Package)
return false, "Cannot access the docs folder: " .. msg
end
f:close()
-
+
-- Generate the docs:
classPackage.genDocs = genPackageDocs
classClass.genDocs = genClassDocs
@@ -858,7 +858,7 @@ end
function preprocess_hook(a_Package)
assert(a_Package)
assert(type(a_Package.code) == "string")
-
+
-- Replace all DoxyComments with placeholders so that they aren't erased later on:
a_Package.code = a_Package.code
:gsub("/%*%*%s*(.-)%s*%*/",