#Call GML function from C++ extension
3 messages · Page 1 of 1 (latest)
Not ideal, but I'm now using the Async - Social event to handle calling GML from my extension.
I have this Async - Social event and a C++ DLL with the LUA_REGISTER macro. The code runs normally, but I want the Lua test() function to return the 3157 that gets pushed in the Async - Social event. How do I do that?
Async - Social's code:
var _S = ds_map_find_value(mods, async_load[? "mod"]);
switch (async_load[? "method"]) {
case "test":
GMS2ModderPushNumber(_S, 3157); // This basically runs lua_pushnumber(L, 3157);
break;
}
LUA_REGISTER's code:
#define LUA_REGISTER(methodName) lua_register(L, methodName, [](lua_State* L) -> int { \
DSMap* map = new DSMap(); \
map->addString("method", methodName); \
map->send(); \
return 1; \
});
Yes I know the Async - Social event's asynchronous and that's probably why it's causing the issue, but I don't know the IDs of other events.