Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed @func #382

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Scripts/DCS-BIOS/lib/common/Functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ module("Functions", package.seeall)

local Functions = {}

--- @func Returns the path of the calling script
--- Returns the path of the calling script
--- @return string
function Functions.scriptPath()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("(.*/)")
end

--- @func Returns value if not nil or an empty string
--- Returns value if not nil or an empty string
--- @param value string?
--- @return string
function Functions.coerce_nil_to_string(value)
return value and value or ""
end

--- @func Constructs a string of the specified length with the left padded by whitespace if necessary.
--- Constructs a string of the specified length with the left padded by whitespace if necessary.
--- @param str string? The base text
--- @param len number The length the string should be
--- @return string result A new string of length len, with whitespace padding added to the left as necessary
Expand All @@ -25,14 +25,14 @@ function Functions.pad_left(str, len)
return string.rep(" ", len - #str) .. str
end

--- @func Takes a string and checks for nil, returns 1 or 0
--- Takes a string and checks for nil, returns 1 or 0
--- @param str string?
--- @return integer
function Functions.nil_state_to_int_flag(str)
return str and 1 or 0
end

--- @func Takes a strings, returns "1" if neither is nil, otherwise "0".
--- Takes a strings, returns "1" if neither is nil, otherwise "0".
--- Please strongly consider using nil_state_to_int_flag instead of this function. This function exists for legacy purposes only.
--- @param str string?
--- @return string
Expand Down
4 changes: 2 additions & 2 deletions Scripts/DCS-BIOS/lib/common/JSONHelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local JSON = json and json() or require("JSON") -- if that fails, fall back to m
--- @class JSONHelper
local JSONHelper = {}

--- @func Encodes to JSON and writes to file
--- Encodes to JSON and writes to file
--- @param value any
--- @param filename string File name including path
function JSONHelper.encode_to_file(value, filename)
Expand All @@ -24,7 +24,7 @@ function JSONHelper.encode_to_file(value, filename)
end
end

--- @func Encodes to JSON and writes to file
--- Encodes to JSON and writes to file
--- @param filename string File name including path
--- @return table
function JSONHelper.decode_from_file(filename)
Expand Down
16 changes: 8 additions & 8 deletions Scripts/DCS-BIOS/lib/common/Logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module("Logger", package.seeall)
--- @field private bytesLogged number Used by log_table
local Logger = {}

--- @func Returns new Logger
--- Returns new Logger
--- @return Logger
function Logger:new(logfile)
local o = {
Expand All @@ -19,7 +19,7 @@ function Logger:new(logfile)
return o
end

--- @func Tries to log the object
--- Tries to log the object
--- @param obj any Object
function Logger:log(obj)
if obj == nil then
Expand All @@ -34,7 +34,7 @@ function Logger:log(obj)
end
end

--- @func Logs string or number
--- Logs string or number
--- @param data string|number
function Logger:log_simple(data)
if data == nil then
Expand All @@ -53,7 +53,7 @@ function Logger:log_simple(data)
end
end

--- @func Logs whether variable is nilstring or number
--- Logs whether variable is nilstring or number
--- @param variableName string
--- @param variable any
function Logger:log_is_nil(variableName, variable)
Expand All @@ -65,7 +65,7 @@ function Logger:log_is_nil(variableName, variable)
self:log_simple(variableName .. " is not nil")
end

--- @func Logs the type of the variable
--- Logs the type of the variable
--- @param name string Name of variable
--- @param variable any The variable to determine type of
function Logger:log_type(name, variable)
Expand All @@ -88,7 +88,7 @@ end
-- Break ALL when max depth reached
-- Break when data logged exceeds limit

--- @func Logs a table (recursively if table contains tables)
--- Logs a table (recursively if table contains tables)
--- @param tab table Table to dump/log
--- @param max_depth integer How deep recursively to go
function Logger:log_table(tab, max_depth, max_bytes_to_log)
Expand All @@ -100,7 +100,7 @@ end
function Logger:dump_table(tab, max_depth, max_bytes_to_log)
self.bytesLogged = 0
-- Inner function just to hide the depth argument
--- @func Recursive table dump
--- Recursive table dump
--- @param tablex table
--- @param depth number
--- @param max_depth number
Expand Down Expand Up @@ -148,7 +148,7 @@ function Logger:dump_table(tab, max_depth, max_bytes_to_log)
return result_code, result_buffer
end

--- @func Logs a table's indexes
--- Logs a table's indexes
--- @require tab table Table to dump/log
function Logger:log_table_indexes(tab)
if tab == nil then
Expand Down
20 changes: 10 additions & 10 deletions Scripts/DCS-BIOS/lib/io/Socket_API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@
--- A lua sockets socket connection
SocketConnection = {}

--- @func Changes the connection timeout value
--- Changes the connection timeout value
--- @param value integer the timeout to set
function SocketConnection:settimeout(value) end

--- @func Sends data to the socket
--- Sends data to the socket
--- @param data string the data to send
--- @return integer? success_code
--- @return string? error
function SocketConnection:send(data) end

--- @func Receives data from the socket
--- Receives data from the socket
--- @param buffer_size integer? the max amount of data to receive
--- @return string? data the data received
--- @return string? error whether there was an error receiving data
--- @return string? partial any partial data received
function SocketConnection:receive(buffer_size) end

--- @func Closes the socket connection
--- Closes the socket connection
function SocketConnection:close() end

--- @class UDPSocketConnection: SocketConnection
--- A lua sockets UDP socket connection
UDPSocketConnection = {}

--- @func Binds the UDP object to a local address
--- Binds the UDP object to a local address
--- @param address string the address to bind to
--- @param port integer the port at the address to bind to
--- @return integer? success_code
--- @return string? error
function UDPSocketConnection:setsockname(address, port) end

--- @func Changes the peer of the UDP object, turning it from unconnected to connected or vice-versa
--- Changes the peer of the UDP object, turning it from unconnected to connected or vice-versa
--- @param address string the address to connect to
--- @param port integer the port at the address to connect to
--- @return integer? success_code
Expand All @@ -46,18 +46,18 @@ function UDPSocketConnection:setpeername(address, port) end
--- A lua socket
Socket = {}

--- @func Throws an acception if ret1 is falsy, using ret2 as the error message.
--- Throws an acception if ret1 is falsy, using ret2 as the error message.
--- @param ret1 any? the first return value to determine whether to throw an error
--- @vararg string? remaining return values to add to the error message if necessary
function Socket.try(ret1, ...) end

--- @func Gets the current udp socket connection
--- Gets the current udp socket connection
--- @return UDPSocketConnection socket_connection the udp socket connection
function Socket.udp()
return {}
end

--- @func Creates and returns a connection acceptor bound to the specified address
--- Creates and returns a connection acceptor bound to the specified address
--- @param address string the address to bind to
--- @param port integer the port on the address to bind to
--- @param backlog integer? the number of allowed connectinos to be queued
Expand All @@ -70,7 +70,7 @@ end
--- A lua sockets TCP socket connection
TCPSocketConnection = {}

--- @func Accepts any pending incoming connection
--- Accepts any pending incoming connection
--- @return TCPSocketConnection? connection a new socket connection for the incoming connection
--- @return string? error the error message, if any
function TCPSocketConnection:accept() end
62 changes: 31 additions & 31 deletions Scripts/DCS-BIOS/lib/meta_files/DCS_API_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ end
--- DCS Cockpit Device
CockpitDevice = {}

--- @func Updates device's arguments
--- Updates device's arguments
function CockpitDevice:update_arguments() end

--- @func Sets command for a device
--- Sets command for a device
--- @param command_id integer
--- @param value integer
function CockpitDevice:SetCommand(command_id, value) end

--- @func Sets a device's argument?
--- Sets a device's argument?
--- @param argument_id integer
--- @param value integer
function CockpitDevice:set_argument_value(argument_id, value) end

--- @func Sets a device's frequency
--- Sets a device's frequency
--- @param frequency number
function CockpitDevice:set_frequency(frequency) end

--- @func Gets a device's frequency
--- Gets a device's frequency
--- @return number
function CockpitDevice:get_frequency() end

--- @func Gets a device based on the device ID as specified in devices.lua
--- Gets a device based on the device ID as specified in devices.lua
--- @param argument_id integer
--- @return number The current value of the CockpitDevice
function CockpitDevice:get_argument_value(argument_id) end

--- @func Makes the device perform an action
--- Makes the device perform an action
--- @param command_id integer
--- @param argument number
function CockpitDevice:performClickableAction(command_id, argument)

end


--- @func Gets a device based on the device ID as specified in devices.lua
--- Gets a device based on the device ID as specified in devices.lua
--- @param device_id integer
--- @return CockpitDevice
function GetDevice(device_id) end

--- @func Gets the draw value for a certain animation
--- Gets the draw value for a certain animation
--- @param draw_argument_id integer
--- @return number
function LoGetAircraftDrawArgumentValue(draw_argument_id) end
Expand All @@ -79,28 +79,28 @@ LatLongAlt = {}
--- @field LatLongAlt LatLongAlt
AicraftData = {}

--- @func Returns SelfData that holds information about the aircraft
--- Returns SelfData that holds information about the aircraft
--- @return AicraftData
function LoGetSelfData() end

--- @func Returns the simulation time
--- Returns the simulation time
--- @return number
function LoGetModelTime() end


--- @func Returns the mission start time
--- Returns the mission start time
--- @return number
function LoGetMissionStartTime() end

--- @func Returns whether own ships/aircraft data can be exported.
--- Returns whether own ships/aircraft data can be exported.
--- @return boolean
function LoIsOwnshipExportAllowed() end

--- @func Returns pilot's name
--- Returns pilot's name
--- @return string
function LoGetPilotName() end

--- @func Returns indicated airspeed
--- Returns indicated airspeed
--- @return number
function LoGetIndicatedAirSpeed() end

Expand All @@ -114,11 +114,11 @@ function LoGetIndicatedAirSpeed() end
--- @field z number
AccelerationUnit = {}

--- @func Returns G Load
--- Returns G Load
--- @return AccelerationUnit
function LoGetAccelerationUnits() end

--- @func Returns ADI pitch, band, yaw
--- Returns ADI pitch, band, yaw
--- @return number
function LoGetADIPitchBankYaw()
return unpack({0, 0, 0});
Expand All @@ -131,54 +131,54 @@ end
--- @field flare number
CounterMeasures = {}

--- @func Returns information about countermeasures
--- Returns information about countermeasures
--- @return CounterMeasures
function LoGetSnares() end

--- @func Returns a string with values separated by -----------------------------------------\n
--- Returns a string with values separated by -----------------------------------------\n
--- for a cockpit screen or device
--- @return string
function list_indication(indicator_id) end

CockpitPage = ""

--- @func Returns a list of pages (cockpit screens)
--- Returns a list of pages (cockpit screens)
--- @return string
function list_cockpit_params() end

--- @func Returns altitude above sea level
--- Returns altitude above sea level
--- @return number
function LoGetAltitudeAboveSeaLevel() end

--- @func Returns altitude above ground level
--- Returns altitude above ground level
--- @return number
function LoGetAltitudeAboveGroundLevel() end

--- @func Returns vertical velocity
--- Returns vertical velocity
--- @return number
function LoGetVerticalVelocity() end

--- @func Returns true air speed
--- Returns true air speed
--- @return number
function LoGetTrueAirSpeed() end

--- @func Returns mach number
--- Returns mach number
--- @return number
function LoGetMachNumber() end

--- @func Returns angle of attack
--- Returns angle of attack
--- @return number
function LoGetAngleOfAttack() end

--- @func Returns glide deviation
--- Returns glide deviation
--- @return number
function LoGetGlideDeviation() end

--- @func Returns side deviation
--- Returns side deviation
--- @return number
function LoGetSideDeviation() end

--- @func Returns slip ball position
--- Returns slip ball position
--- @return number
function LoGetSlipBallPosition() end

Expand All @@ -205,7 +205,7 @@ EngineSide = {}
--- @field fuel_external number
EngineInformation = {}

--- @func Returns engine information
--- Returns engine information
--- @return EngineInformation
function LoGetEngineInfo() end

Expand All @@ -223,7 +223,7 @@ GearValue = {}
--- @field gear GearValue
MechanicalInformation = {}

--- @func Returns mechanical information
--- Returns mechanical information
--- @return MechanicalInformation
function LoGetMechInfo() end

Expand Down
Loading