I have some code using Luabind, and I need to execute a function (from C++) if it's present in the _G table, but otherwise do nothing. How do I detect if a function is present in _G or not?
+1
A:
Something like this should work:
if (luabind::object f = luabind::globals(L)["f"])
{
f(...);
}
Daniel Wallin
2010-02-09 08:46:22