This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
# Breif - A minimal working CMakeLists.txt for goggle unittesting | |
# Author - Fredrik Persson - [email protected] | |
# Licens - BSD | |
cmake_minimum_required (VERSION 2.6) | |
project(demo) | |
find_package (GTest REQUIRED) | |
include_directories(${GTest_INCLUDE_DIRS}) |
---------------------------------------------------------------------------------------------------- | |
--- Making Lua look like Prolog: | |
--- | |
--- Let's use metatables for something other than emulating prototype-based OO. By making the | |
--- __index metamethod create values for undefined things, we can make Lua look like Prolog! | |
--- We create empty tables for anything starting with a capital letter, functions that populate | |
--- those tables for lowercase things (to assign relationships) and if a name begins with "is_" | |
--- then it becomes a function that queries those tables. | |
---------------------------------------------------------------------------------------------------- |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
namespace = {} | |
namespace.class = {} | |
namespace.class.__index=namespace.class | |
function namespace.class:create(name) | |
print("Create a class") | |
local l = {} | |
setmetatable(l, namespace.class) | |
l.m_name = name |