summaryrefslogtreecommitdiffstats
path: root/tolua++-1.0.93/src/bin/lua/define.lua
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 21:25:04 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 21:25:04 +0200
commitaafef187ef856a36c3f8e599afea2dee44f08904 (patch)
treec84762cc768da2800a0f80b902c704e782bd29ef /tolua++-1.0.93/src/bin/lua/define.lua
parentMCServer c++ source files (diff)
downloadcuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar
cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.gz
cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.bz2
cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.lz
cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.xz
cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.zst
cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.zip
Diffstat (limited to 'tolua++-1.0.93/src/bin/lua/define.lua')
-rw-r--r--tolua++-1.0.93/src/bin/lua/define.lua63
1 files changed, 63 insertions, 0 deletions
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
+
+