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

📄 typedef.lua

📁 脚本编程语言
💻 LUA
字号:
-- tolua: typedef 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. -- Typedef class-- Represents a type synonym.-- The 'de facto' type replaces the typedef before the-- remaining code is parsed.-- The following fields are stored:--   utype = typedef name--   type = 'the facto' type--   mod = modifiers to the 'de facto' typeclassTypedef = { utype = '', mod = '', type = ''}classTypedef.__index = classTypedef-- Print methodfunction classTypedef:print (ident,close) print(ident.."Typedef{") print(ident.." utype = '"..self.utype.."',") print(ident.." mod = '"..self.mod.."',") print(ident.." type = '"..self.type.."',") print(ident.."}"..close)end-- Return it's not a variablefunction classTypedef:isvariable () return falseend-- Internal constructorfunction _Typedef (t) setmetatable(t,classTypedef) appendtypedef(t) return tend-- Constructor-- Expects one string representing the type definition.function Typedef (s) if strfind(s,'[%*&]') then  tolua_error("#invalid typedef: pointers (and references) are not supported") end local t = split(gsub(s,"%s%s*"," ")," ") return _Typedef {  utype = t[t.n],  type = t[t.n-1],  mod = concat(t,1,t.n-2), }end

⌨️ 快捷键说明

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