summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaNameLookup.cpp
blob: 5ac6ede87affb7941a37af951afa993e5f708880 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

// LuaNameLookup.cpp

// Implements the cLuaNameLookup class used as the cNetwork API callbacks for name and IP lookups from Lua

#include "Globals.h"
#include "LuaNameLookup.h"





cLuaNameLookup::cLuaNameLookup(const AString & a_Query, cLuaState::cTableRefPtr && a_Callbacks) :
	m_Callbacks(std::move(a_Callbacks)), m_Query(a_Query)
{
}





void cLuaNameLookup::OnNameResolved(const AString & a_Name, const AString & a_IP)
{
	m_Callbacks->CallTableFn("OnNameResolved", a_Name, a_IP);
}





void cLuaNameLookup::OnError(int a_ErrorCode, const AString & a_ErrorMsg)
{
	m_Callbacks->CallTableFn("OnError", m_Query, a_ErrorCode, a_ErrorMsg);
}





void cLuaNameLookup::OnFinished(void)
{
	m_Callbacks->CallTableFn("OnFinished", m_Query);
}