Skip to content

Lua program crashes when using delegates instead of function pointers #87

Open
@WebFreak001

Description

@WebFreak001

I didnt try with a clean app but with my engine it crashes (only for other people, I couldn't reproduce it) when i use

// LuaState lua
LuaTable table = lua.newTable();
table["derp"] = () { return player.x; };

When I use derp frequently by calling the lua function which calls derp it will eventually crash after some undefined time. However when I create a function for that and then reference that, it will never crash. Maybe its something with the D garbage collector deleting the lambdas because it thinks it isnt used. So this works:

// LuaState lua
LuaTable table = lua.newTable();
int derp() { return player.x; }
table["derp"] = &derp;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions