Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些使用 Luabind 的代码,如果它存在于 _G 表中,我需要执行一个函数(来自 C++),否则什么也不做。如何检测 _G 中是否存在函数?
像这样的东西应该工作:
if (luabind::object f = luabind::globals(L)["f"]) { f(...); }