defaultParseArgs
Definition
-- @/lua/ge/client/parseArgs.lua:29
-- The default global argument parsing
local function defaultParseArgs()
M.args = {}
local argumentCount = tonumber(getConsoleVariable("$Game::argc"))
-- log('I','parse','$Game::argv = '..getConsoleVariable("$Game::argv")..' argumentCount: '..tostring(argumentCount))
if argumentCount then
for i = 0, argumentCount - 1 do
local arg = getConsoleVariable("$Game::argv".. tostring(i))
local nextArg = getConsoleVariable("$Game::argv".. tostring(i + 1))
local hasNextArg = (argumentCount - i) > 1
-- log('I','parse'," $Game::argv".. tostring(i).."= "..tostring(arg))
if arg == "-log" then
if hasNextArg == true then
-- Turn on console logging
if nextArg ~= 0 then
-- Dump existing console to logfile first.
nextArg = nextArg + 4
end
setLogMode(nextArg)
setConsoleVariable("$logModeSpecified", true)
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -log ")
end
elseif arg == "-cefdev" then
enableCEFDevConsole(true)
elseif arg == "-fullscreen" then
setFullScreen(true)
elseif arg == "-windowed" then
setFullScreen(false)
elseif arg == "-vehicleConfig" then
if hasNextArg then
M.args.vehicleConfig = nextArg
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -vehicleConfig \"pickup/myConfig.pc\"")
end
elseif arg == "-vehicle" then
if hasNextArg then
setConsoleVariable("$beamngVehicleArgs", nextArg)
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -vehicle ")
end
elseif arg == "-luafile" then
if hasNextArg then
require(nextArg)
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -luafile ")
end
elseif arg == "-lua" then
if hasNextArg then
LuaExecuteQueueString(nextArg)
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -lua ")
end
elseif arg == "-onLevelLoad_ext" then
if hasNextArg then
queueCmdlineLevelLoadExtension(nextArg)
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -onLevelLoad_ext ")
end
elseif arg == "-level" then
if hasNextArg then
setConsoleVariable("$levelToLoad", nextArg)
i = i + 1
else
log("E", "", "Error: Missing Command Line argument. Usage: -level ")
end
elseif arg == "-worldeditor" then
log("E", "", "Error: The -worldeditor argument was deprecated. Please use -worldEditor (camel case) instead.")
elseif arg == "-tcom" or arg == "-tcom-capture" then
local success, err = pcall(function()
extensions.load('tech/techCore')
end)
if not success then
log("E", "", "Error: Cannot load techCore extension.")
elseif arg == "-tcom" then
tech_techCore.openServer()
end
end
end
end
end
Callers
@/lua/ge/main.lua
parseArgs.defaultParseArgs()