[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: how to replace a function correctly
- From: "nikdo79" <dominik-wagner@...>
- Date: Thu, 21 Mar 2002 13:20:37 -0000
hi there!
following szenario:
Let's say i want to replace print by another c function (printc),
but depending on the input of print.
the way i would do it now is the following:
lua_register(State, "_____myprint",printc);
lua_dostring(State,
"do "
" local _print,myprint=print,_____myprint "
" _____myprint=nil"
" function print(...) "
" if condition then myprint(unpack(arg)) "
" else print(unpack(arg)) "
" end "
"end")
is there a posibility to put a c function in a kind of local scope?
i find this workaround is far too messy.
dom