From aafef187ef856a36c3f8e599afea2dee44f08904 Mon Sep 17 00:00:00 2001 From: faketruth Date: Mon, 3 Oct 2011 19:25:04 +0000 Subject: Source for additional projects -jsoncpp -lua -tolua++ -WebServer -zlib -iniFile git-svn-id: http://mc-server.googlecode.com/svn/trunk@4 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- tolua++-1.0.93/src/bin/lua/define.lua | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tolua++-1.0.93/src/bin/lua/define.lua (limited to 'tolua++-1.0.93/src/bin/lua/define.lua') diff --git a/tolua++-1.0.93/src/bin/lua/define.lua b/tolua++-1.0.93/src/bin/lua/define.lua new file mode 100644 index 000000000..96a28d878 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/define.lua @@ -0,0 +1,63 @@ +-- 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 name +classDefine = { + name = '', +} +classDefine.__index = classDefine +setmetatable(classDefine,classFeature) + +-- register define +function classDefine:register (pre) + if not self:check_public_access() then + return + end + + pre = pre or '' + output(pre..'tolua_constant(tolua_S,"'..self.lname..'",'..self.name..');') +end + +-- Print method +function classDefine:print (ident,close) + print(ident.."Define{") + print(ident.." name = '"..self.name.."',") + print(ident.." lname = '"..self.lname.."',") + print(ident.."}"..close) +end + + +-- Internal constructor +function _Define (t) + setmetatable(t,classDefine) + t:buildnames() + + if t.name == '' then + error("#invalid define") + end + + append(t) + return t +end + +-- Constructor +-- Expects a string representing the constant name +function Define (n) + return _Define{ + name = n + } +end + + -- cgit v1.2.3