What is _ in function or variable name?

local Class = {}
Class.__index = Class

function Class.new()
   local self = setmetatable({}, Class)
   self._Variable = 1
   return self
end

function Class:_function()

end

Like this, i can’t understand the usage of that _.

_something usually denotes a “private” variable or method. Basically, it shouldn’t be accessed outside of the class itself.

1 Like

Then, if it is module script, it cannot be used outside the module?

It can be used outside the module if given access to it. It’s not meant to be changed externally (unless it is).

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.