inline_t bool Library::RegisterFunction(Visibility visibility, const String & name, FunctionCallback function) { if (name.empty()) { LogWriteLine("Registered function requires a valid name"); return false; } if (!function) { LogWriteLine("Registered function requires a valid callback"); return false; } // Calculate the function signature auto signature = CreateFunctionSignature(visibility, name); if (!signature.IsValid()) return false; // Register function in library table. This allows the the parser to find // and use this function. RegisterFunctionSignature(signature); // Register the function definition with the runtime system for // runtime lookups. auto runtime = m_runtime.lock(); if (!runtime) return false; runtime->RegisterFunction(signature, function); // Return success return true; }
void Connection::logWriteLine(const std::string & line) { #ifdef _DEBUG LogWriteLine("<" + GetRemoteAddress() + "> " + line); #endif }