diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 21:25:04 +0200 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 21:25:04 +0200 |
commit | aafef187ef856a36c3f8e599afea2dee44f08904 (patch) | |
tree | c84762cc768da2800a0f80b902c704e782bd29ef /tolua++-1.0.93/src/bin/lua/namespace.lua | |
parent | MCServer c++ source files (diff) | |
download | cuberite-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/namespace.lua')
-rw-r--r-- | tolua++-1.0.93/src/bin/lua/namespace.lua | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tolua++-1.0.93/src/bin/lua/namespace.lua b/tolua++-1.0.93/src/bin/lua/namespace.lua new file mode 100644 index 000000000..6ca80e6e3 --- /dev/null +++ b/tolua++-1.0.93/src/bin/lua/namespace.lua @@ -0,0 +1,52 @@ +-- tolua: namespace class +-- Written by Waldemar Celes +-- TeCGraf/PUC-Rio +-- Jul 2003 +-- $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. + + +-- Namespace class +-- Represents a namesapce definition. +-- Stores the following fields: +-- name = class name +-- {i} = list of members +classNamespace = { + classtype = 'namespace', + name = '', +} +classNamespace.__index = classNamespace +setmetatable(classNamespace,classModule) + +-- Print method +function classNamespace:print (ident,close) + print(ident.."Namespace{") + 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 constructor +function _Namespace (t) + setmetatable(t,classNamespace) + append(t) + return t +end + +-- Constructor +-- Expects the name and the body of the namespace. +function Namespace (n,b) + local c = _Namespace(_Container{name=n}) + push(c) + c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces + pop() +end + |