Rici Lake <lua@ricilake.net> [2007-03-25 23:36:16]:
It's something like this:
int lua_get_function(char *function)
{
lua_getfield(L, LUA_GLOBALSINDEX, function);
if (!lua_isfunction(L, -1)) {
return FALSE;
}
return TRUE;
}
int lua_event_generic(char *event_name, char *event_text, int param)
{
int ret = 0;
char fnc[MAX_PATH] = {0};
char err[MAX_PATH] = {0};
_snprintf(fnc, MAX_PATH-1, "gabenie_event_%s", event_name);
_snprintf(err, MAX_PATH-1, "error gabenie_event_%s()", event_name);
if (!lua_get_function(fnc)) {
return ret;
}