lua-users home
lua-l archive

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


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