define.lua

来自「脚本编程语言」· LUA 代码 · 共 59 行

LUA
59
字号
-- tolua: define class-- Written by Waldemar Celes-- TeCGraf/PUC-Rio-- Jul 1998-- $Id: define.lua,v 1.2 1999/07/28 22:21:08 celes Exp $-- 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. -- Define class-- Represents a numeric const definition-- The following filds are stored:--   name = constant nameclassDefine = { name = '',}classDefine.__index = classDefinesetmetatable(classDefine,classFeature)-- register definefunction classDefine:register () output(' tolua_constant(tolua_S,"'..self.lname..'",'..self.name..');') end-- Print methodfunction classDefine:print (ident,close) print(ident.."Define{") print(ident.." name = '"..self.name.."',") print(ident.." lname = '"..self.lname.."',") print(ident.."}"..close)end-- Internal constructorfunction _Define (t) setmetatable(t,classDefine) t:buildnames() if t.name == '' then  error("#invalid define") end append(t) return tend-- Constructor-- Expects a string representing the constant namefunction Define (n) return _Define{  name = n }end

⌨️ 快捷键说明

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