77 rocale-cli run [options]
88
99REQUIRED:
10- -u, --universeId <id> Target universe ID to spawn an Open Cloud instance of
11- -p, --placeId <id> Target place ID to spawn an Open Cloud instance of
12- --apiKey <key> Roblox API key (or set ROBLOX_API_KEY env var)
10+ -u, --universeId <id> Target universe ID to spawn an Open Cloud instance of
11+ -p, --placeId <id> Target place ID to spawn an Open Cloud instance of
12+ --apiKey <key> Roblox API key (or set ROBLOX_API_KEY env var)
1313
1414LOAD OPTIONS:
15- --load.project <file> Rojo project.json/rbxp to build and load (requires rojo or robloxdev-cli)
16- --load.place <file> Load an rbxl
17- --load.version <num> Load existing place version without building/uploading
18- (set to 0 to rerun last uploaded version)
15+ --load.project <file> Rojo project.json/rbxp to build and load (requires rojo or robloxdev-cli)
16+ --load.place <file> Load an rbxl
17+ --load.version <num> Load existing place version without building/uploading
18+ (set to 0 to rerun last uploaded version)
1919
2020BUILD OPTIONS:
21- --output <file> Output file path for the built place file
22- (default: output.rbxl)
23- --script <file> Luau script to load and set as entrypoint
21+ --output <file> Output file path for the built place file
22+ (default: output.rbxl)
23+ --script <file> Luau script to load and set as entrypoint
2424
2525EXECUTION OPTIONS:
26- --timeout <seconds> Timeout for polling task completion (default: 300)
27- --pollInterval <seconds> Interval between polling attempts (default: 2)
28- --binaryOutput <file> Path to save binary output from the task
26+ --lua.globals <key=value,...> Comma-separated list of Lua globals to inject
27+ --timeout <seconds> Timeout for polling task completion (default: 300)
28+ --pollInterval <seconds> Interval between polling attempts (default: 2)
29+ --binaryOutput <file> Path to save binary output from the task
2930
3031FLAGS:
31- -v, --verbose Enable verbose logging
32- --help Show this help message
32+ -v, --verbose Enable verbose logging
33+ --help Show this help message
3334]] )
3435end
3536
@@ -55,6 +56,7 @@ return function(...)
5556 args :add ("load.version" , "option" )
5657 args :add ("load.place" , "option" )
5758 args :add ("apiKey" , "option" )
59+ args :add ("lua.globals" , "option" , { default = nil })
5860 args :add ("timeout" , "option" , { default = "300" })
5961 args :add ("pollInterval" , "option" , { default = "2" })
6062 args :add ("binaryOutput" , "option" , { default = nil })
@@ -76,6 +78,21 @@ return function(...)
7678 or args :get ("apiKey" )
7779 or log .fatal ("Missing API Key: Set ROBLOX_API_KEY environment variable or provide it as an argument" )
7880
81+ local luaGlobals = {}
82+ if args :get ("lua.globals" ) then
83+ local globals = args :get ("lua.globals" )
84+ assert (globals , "Expected globals to be a comma-separated list of key=value pairs" )
85+
86+ for _ , pair in ipairs (string.split (globals , "," )) do
87+ local key , value = pair :match ("([^=]+)=([^=]+)" )
88+ if key and value then
89+ luaGlobals [key ] = value
90+ else
91+ log .fatal ("Expected format for globals is key=value" )
92+ end
93+ end
94+ end
95+
7996 local placeInfo : ocaleSdk .PlaceInfo = {
8097 universeId = tonumber (args :get ("universeId" )) or log .fatal ("Missing a universe ID" ),
8198 placeId = tonumber (args :get ("placeId" )) or log .fatal ("Missing a place ID" ),
@@ -140,12 +157,22 @@ return function(...)
140157 end
141158 assert (entryScript )
142159
143- local enableBinaryOutput = false
160+ local binaryOutputPath = nil
144161 if args :get ("binaryOutput" ) then
145- enableBinaryOutput = true
162+ binaryOutputPath = args : get ( "binaryOutput" )
146163 end
164+ assert (binaryOutputPath , "Binary output path should be a valid file path" )
165+ local enableBinaryOutput = binaryOutputPath ~= nil
147166
148- local task = ocaleSdk .createTask (apiKey , placeInfo , entryScript , tonumber (args :get ("timeout" )), nil , enableBinaryOutput )
167+ local task = ocaleSdk .createTask (
168+ apiKey ,
169+ placeInfo ,
170+ entryScript ,
171+ tonumber (args :get ("timeout" )),
172+ nil ,
173+ enableBinaryOutput ,
174+ luaGlobals
175+ )
149176 local completedTask = ocaleSdk .pollTaskCompletion (
150177 apiKey ,
151178 task .path ,
@@ -158,8 +185,8 @@ return function(...)
158185
159186 if enableBinaryOutput and completedTask .binaryOutputUri then
160187 local binaryOutput = ocaleSdk .getBinaryOutput (completedTask .binaryOutputUri )
161- fs .writestringtofile (args : get ( "binaryOutput" ) , binaryOutput )
162- log .info (`{richterm .green ("✓" , log .noColor ())} Binary output saved to '{args : get ( "binaryOutput" ) }'` )
188+ fs .writestringtofile (binaryOutputPath , binaryOutput )
189+ log .info (`{richterm .green ("✓" , log .noColor ())} Binary output saved to '{binaryOutputPath }'` )
163190 end
164191
165192 if completedTask .state == "FAILED" then
0 commit comments