Is it possible to generate Events and Hooks in Lua for any game without built-in support?

Posted by pr0tocol on Game Development See other posts from Game Development or by pr0tocol
Published on 2012-01-20T15:41:21Z Indexed on 2012/05/30 17:02 UTC
Read the original article Hit count: 245

Filed under:
|

Does a game have to have built-in functions to accept and run lua scripts, or can I design Events and Hooks using Lua on any game I please, akin to the days where C code could be used to hook into the WinAPI using dlls?

The reason I ask is, I am trying to create a background application that will perform events and hooks on a particular game that does not currently support lua in-game.

Brief examples:

Events: - An action executed by the PLAYER is detected. For instance, hitting the Q key will normally make my character use an ability, but with my Lua script running in the background, will cause a sound to play on my computer (or something).

Hooks: - An action within the GAME is detected. For instance, the game spawns an enemy every minute. When an enemy spawns, the script will detect this and perform an action, for instance playing a sound locally on the computer.

I would like to do both, but I know for games like Garry's Mod, the game already has built-in support for running lua scripts.

Is there a way to do either events OR hooks using lua similarly to how C/C++ can connect to a game using WinAPI dlls?

© Game Development or respective owner

Related posts about lua

Related posts about events