★ Class member variable naming rules The
member variable needs to be defined and initialized in the constructor, and given a certain comment according to the actual meaning, so that the code is easy to read.
1 The first letter is lowercase, written in camel case, try to be short and clear, and don't use difficult-to-understand words or strange pinyin combinations.
2Private member variables must start with an underscore
local TestClass = class("TestClass")
--构造函数
function TestClass:ctor()
self._data = {
} --私有成员变量必须以下划线开头,再以驼峰的编写方式
self._dataType = 1 --私有成员变量必须以下划线开头,再以驼峰的编写方式
self._name = "" --私有成员变量必须以下划线开头,再以驼峰的编写方式
end
return TestClass
References: Front-end specifications