Frontend and backend communication
Pelle
pelle.mansson at gmail.com
Wed Aug 10 02:20:47 PDT 2011
On Wed, 10 Aug 2011 10:35:46 +0200, Dainius (GreatEmerald)
<pastas4 at gmail.com> wrote:
> I seem to have run into a problem with the function pointer method
> here. I have this code:
>
> arco.d:
>
> struct FrontendFunctions {
> void function(SoundTypes) Sound_Play;
> void function() RedrawScreenFull;
> void function(const char*, int) PrecacheCard;
> void function(CardInfo, int) PlayCardAnimation;
> }
>
> cards.d:
>
> void InitLuaFunctions()
> {
> lua["Damage"] = (int Who, int Amount)
> {
> FrontendFunctions.Sound_Play(SoundTypes.Damage);
> };
> }
>
> Essentially I am trying to get Lua (via LuaD) to call a function in D
> that calls a frontend function. But when I compile the code, I get
> this: "cards.d(5): Error: 'this' is only defined in non-static member
> functions, not __dgliteral14". Why is this and what can I do about it?
FrontendFunctions frontendFunctions;
use frontendFunctions everywhere.
OR (this makes them global):
struct FrontendFunctions {
static:
...
}
More information about the Digitalmars-d-learn
mailing list