모듈:No globals

w:ko>ChongDae님의 2014년 8월 29일 (금) 16:05 판 (사용자가 "모듈:No globals" 문서를 보호했습니다: 훼손시 영향이 큰 틀 문서 ([편집=관리자만 허용] (무기한) [옮기기=관리자만 허용] (무기한)))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

{{#css: .template-documentation {

   clear: both;
   margin: 1em 0 0 0;
   padding: 1em

} /* 아래 상자 */ .mbox-text {

   clear: both;
   background-color: #e8ffe8;

}

.template-documentation-template-data .mw-templatedata-doc-desc {

   display: none;

}

}}

설명문서 [보기] [편집] [역사] [새로 고침]
이 모듈 문서의 출처는 위키백과:모듈:No globals입니다.
위 설명은 모듈:No globals/설명문서의 내용을 가져와 보여주고 있습니다.
연습장이나 사용자 문서에서 틀의 사용이나 수정을 연습할 수 있습니다.
분류는 /설명문서에 넣어주세요. 이 틀의 하위문서.

local mt = getmetatable(_G) or {}
function mt.__index (t, k)
	if k ~= 'arg' then
		error('Tried to read nil global ' .. tostring(k), 2)
	end
	return nil
end
function mt.__newindex(t, k, v)
	if k ~= 'arg' then
		error('Tried to write global ' .. tostring(k), 2)
	end
	rawset(t, k, v)
end
setmetatable(_G, mt)