Game Command Override Isn't Being Called

Started by lefthandedhero, May 12, 2024, 08:14:33 PM

Previous topic - Next topic
May 12, 2024, 08:14:33 PM Last Edit: May 16, 2024, 03:37:16 PM by lefthandedhero
In my code, I wrote the "game:on_command_pressed(command)" event to override the built-in behaviour of the sword command. However, when I run my game, the "game:on_command_pressed(command)" event is never called and the built-in behaviour is used.

I put the event in its own metatable called "game_meta.lua" (which is in a file called "meta") and, in features.lua, I wrote, "require("scripts/meta/game_meta")".

Why is the engine not calling the event, and how do I get the engine to call the event?

EDIT: It turns out that I accidentally wrote the wrong variable name in my code; I accidentally wrote "if action == "attack"" instead of "if command == "attack"".