Lua
string类型转枚举
self.topic= {
Topic1 = 1,
Topic2 = 2,
}
function stringToEnum(str)
if self.topic[str] ~= nil then
return self.topic[str]
end
return 0
end
Lua
string类型转枚举
self.topic= {
Topic1 = 1,
Topic2 = 2,
}
function stringToEnum(str)
if self.topic[str] ~= nil then
return self.topic[str]
end
return 0
end