[Lua] Hooking in this implementation?

Irkalla

ENTP POWWWEEEEEER
Joined
Sep 25, 2012
Messages
1,009
Location
Way down around Vicksburg
Anyone know how to hook code into a function in Civ 5's implementation of Lua?

I haven't seen it done... strange.

EDIT: From the looks of it, you just do Type.FunctionName.Add(hook_FunctionName)

Anyone know if this would work?

Code:
Type.FunctionName.Add[COLOR="Blue"][B](
function([/B][/COLOR]arg1, arg2[COLOR="blue"][B])[/B][/COLOR]
    [COLOR="blue"][B]if[/B][/COLOR] [COLOR="blue"][B](true)[/B][/COLOR] [COLOR="blue"][B]then[/B][/COLOR] [COLOR="Green"]-- test for truth[/COLOR]
        doStuff[COLOR="Blue"][B]()[/B][/COLOR]  [COLOR="green"]-- do some stuff[/COLOR]
   [COLOR="blue"] [B]else[/B][/COLOR]
        doOtherStuff[B][COLOR="Blue"]()[/COLOR][/B] [COLOR="green"]-- do some other stuff[/COLOR]
    [COLOR="blue"][B]end[/B][/COLOR]
[COLOR="blue"][B]end)[/B][/COLOR]
 
Back
Top Bottom