lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> the hook and function methods work fine for the call to:
>     screen_update_disable
> but fail on the call to:
>     set_clipboard_text

The function name is available to the closure as an upvalue,
so you don't need a global to hold it as well.  (The
zeus_hook function took care of that.)

>   //-- push macro name (first upvalue)
>   lua_pushvalue(pLuaState, lua_upvalueindex(1));

So now the macro name is at the _top_ of the stack.  You
can use -1 as a stack index to retrieve it:

    String szFunction = lua_tostring(pLuaState, -1);

Make sure to copy the string when you pop it off the stack
as the char* is then invalid (presumably your String type
does this?)

Bye,
Wim