Skip to content

Commit 3039d63

Browse files
committed
refactor: remove unused arguments from functions
1 parent 284b361 commit 3039d63

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

src/lua/api.lua

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ API.last_client_port = nil
1212
-- Update Loop
1313
--------------------------------------------------------------------------------
1414

15-
function API.update(dt)
15+
function API.update(_)
1616
-- Create socket if it doesn't exist
1717
if not API.socket then
1818
API.socket = socket.udp()
@@ -24,8 +24,8 @@ function API.update(dt)
2424

2525
-- Process pending requests
2626
for key, request in pairs(API.pending_requests) do
27-
if request.condition(request.args) then
28-
request.action(request.args)
27+
if request.condition() then
28+
request.action()
2929
API.pending_requests[key] = nil
3030
end
3131
end
@@ -77,7 +77,7 @@ end
7777
function API.init()
7878
-- Hook into the game's update loop
7979
local original_update = love.update
80-
love.update = function(dt)
80+
love.update = function(_)
8181
original_update(BALATRO_BOT_CONFIG.dt)
8282
API.update(BALATRO_BOT_CONFIG.dt)
8383
end
@@ -97,12 +97,12 @@ end
9797
-- API Functions
9898
--------------------------------------------------------------------------------
9999

100-
API.functions["get_game_state"] = function(args)
100+
API.functions["get_game_state"] = function(_)
101101
local game_state = utils.get_game_state()
102102
API.send_response(game_state)
103103
end
104104

105-
API.functions["go_to_menu"] = function(args)
105+
API.functions["go_to_menu"] = function(_)
106106
if G.STATE == G.STATES.MENU and G.MAIN_MENU_UI then
107107
sendDebugMessage("go_to_menu called but already in menu", "BALATROBOT")
108108
local game_state = utils.get_game_state()
@@ -115,11 +115,10 @@ API.functions["go_to_menu"] = function(args)
115115
condition = function()
116116
return G.STATE == G.STATES.MENU and G.MAIN_MENU_UI
117117
end,
118-
action = function(args)
118+
action = function()
119119
local game_state = utils.get_game_state()
120120
API.send_response(game_state)
121121
end,
122-
args = args,
123122
}
124123
end
125124

@@ -166,7 +165,7 @@ API.functions["start_run"] = function(args)
166165
condition = function()
167166
return G.STATE == G.STATES.BLIND_SELECT and G.GAME.blind_on_deck
168167
end,
169-
action = function(args)
168+
action = function()
170169
local game_state = utils.get_game_state()
171170
API.send_response(game_state)
172171
end,
@@ -183,7 +182,7 @@ API.functions["skip_or_select_blind"] = function(args)
183182
condition = function()
184183
return G.GAME and G.GAME.facing_blind and G.STATE == G.STATES.SELECTING_HAND
185184
end,
186-
action = function(args)
185+
action = function()
187186
local game_state = utils.get_game_state()
188187
API.send_response(game_state)
189188
end,
@@ -201,11 +200,10 @@ API.functions["skip_or_select_blind"] = function(args)
201200
}
202201
return prev_state[current_blind] == "Skipped"
203202
end,
204-
action = function(args)
203+
action = function()
205204
local game_state = utils.get_game_state()
206205
API.send_response(game_state)
207206
end,
208-
args = args,
209207
}
210208
else
211209
sendErrorMessage("Invalid action arg for skip_or_select_blind: " .. args.action, "BALATROBOT")
@@ -272,14 +270,14 @@ API.functions["play_hand_or_discard"] = function(args)
272270
end
273271
return false
274272
end,
275-
action = function(args)
273+
action = function()
276274
local game_state = utils.get_game_state()
277275
API.send_response(game_state)
278276
end,
279277
}
280278
end
281279

282-
API.functions["cash_out"] = function(args)
280+
API.functions["cash_out"] = function(_)
283281
-- Validate current game state is appropriate for cash out
284282
if G.STATE ~= G.STATES.ROUND_EVAL then
285283
sendErrorMessage("Cannot cash out when not in shop. Current state: " .. tostring(G.STATE), "BALATROBOT")
@@ -292,39 +290,38 @@ API.functions["cash_out"] = function(args)
292290
condition = function()
293291
return G.STATE == G.STATES.SHOP and #G.E_MANAGER.queues.base < 3 and G.STATE_COMPLETE
294292
end,
295-
action = function(args)
293+
action = function()
296294
local game_state = utils.get_game_state()
297295
API.send_response(game_state)
298296
end,
299-
args = args,
300297
}
301298
end
302299

303-
API.functions["select_booster_action"] = function(args)
300+
API.functions["select_booster_action"] = function(_)
304301
-- TODO: implement
305302
end
306303

307-
API.functions["select_shop_action"] = function(args)
304+
API.functions["select_shop_action"] = function(_)
308305
-- TODO: implement
309306
end
310307

311-
API.functions["rearrange_hand"] = function(args)
308+
API.functions["rearrange_hand"] = function(_)
312309
-- TODO: implement
313310
end
314311

315-
API.functions["rearrange_consumables"] = function(args)
312+
API.functions["rearrange_consumables"] = function(_)
316313
-- TODO: implement
317314
end
318315

319-
API.functions["rearrange_jokers"] = function(args)
316+
API.functions["rearrange_jokers"] = function(_)
320317
-- TODO: implement
321318
end
322319

323-
API.functions["use_or_sell_consumables"] = function(args)
320+
API.functions["use_or_sell_consumables"] = function(_)
324321
-- TODO: implement
325322
end
326323

327-
API.functions["sell_jokers"] = function(args)
324+
API.functions["sell_jokers"] = function(_)
328325
-- TODO: implement
329326
end
330327

0 commit comments

Comments
 (0)