Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualMercurialol

Posted 25 February 2013 - 05:59 AM

Hey guys. I've just integrated lua in my game (which isn't finished yet). Anyway, some things are bothering me.

 

I've registered functions a list of function pointers that I want to be able to call from Lua. It works fine. Although I feel like I'm making a facade between lua and my game and it requires (constant) changes to the code itself. I used lua as a logic for the debuff system in my game just to see what the scripts are all about. I'd basically implement the debuff logic inside the script, load it and execute it on an enemy. I started by making a facade class who's static functions would lua call and delegate the call to the enemy passed from lua to the engine.Something like this:

 

1.Debuff update

2.Call debuff script ( pass the enemy obj. to lua)

3.Debuff logic inside the script

4.Call the adapter class function (and pass the enemy if necessary).

 

Problem: writing function pointers for everything i want to be able to call from lua.

 

I'm pretty sure I'm doing something wrong, so it'd be better if I'd get on the right track from the beginning.

 

Thanks in advance

 

Mercurial


#1Mercurialol

Posted 23 February 2013 - 05:31 PM

Hey guys. I've just integrated lua in my game (which isn't finished yet). Anyway, some things are bothering me.

 

I've registered functions a list of function pointers that I want to be able to call from Lua. It works fine. Although I feel like I'm making a facade between lua and my game and it requires (constant) changes to the code itself. I used lua as a logic for the debuff system in my game just to see what the scripts are all about. I'd basically implement the debuff logic inside the script, load it and execute it on an enemy. I started by making a facade class who's static functions would lua call and delegate the call to the enemy passed from lua to the engine.Something like this:

 

1.Debuff update

2.Call debuff script ( pass the enemy obj. to lua)

3.Debuff logic inside the script

4.Call the facade class function (and pass the enemy if necessary).

 

Problem: writing function pointers for everything i want to be able to call from lua.

 

I'm pretty sure I'm doing something wrong, so it'd be better if I'd get on the right track from the beginning.

 

Thanks in advance

 

Mercurial


PARTNERS