⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module.lua

📁 脚本编程语言
💻 LUA
字号:
-- tolua: module class-- Written by Waldemar Celes-- TeCGraf/PUC-Rio-- Jul 1998-- $Id: $-- This code is free software; you can redistribute it and/or modify it.-- The software provided hereunder is on an "as is" basis, and-- the author has no obligation to provide maintenance, support, updates,-- enhancements, or modifications. -- Module class-- Represents module.-- The following fields are stored:--    {i} = list of objects in the module.classModule = { classtype = 'module'}classModule.__index = classModulesetmetatable(classModule,classContainer)-- register modulefunction classModule:register () push(self) output(' tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')	output(' tolua_beginmodule(tolua_S,"'..self.name..'");') local i=1 while self[i] do  self[i]:register()  i = i+1 end	output(' tolua_endmodule(tolua_S);')	pop()end-- Print methodfunction classModule:print (ident,close) print(ident.."Module{") print(ident.." name = '"..self.name.."';") local i=1 while self[i] do  self[i]:print(ident.." ",",")  i = i+1 end print(ident.."}"..close)end-- Internal constructorfunction _Module (t) setmetatable(t,classModule) append(t) return tend-- Constructor-- Expects two string representing the module name and body.function Module (n,b) local t = _Module(_Container{name=n}) push(t) t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces pop() return tend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -