1LuaGlue 2======= 3 4LuaGlue is a C++11 template based binding library. 5 6It is contained entirely in headers, with no code to link to. 7 8License: Zlib 9 10example 11------- 12 13Lua Code: 14```lua 15local test = Foo.new(333); 16test:abc(1,2,3); 17 18print("ONE: "..Foo.ONE); 19print("TWO: "..Foo.TWO); 20print("THREE: "..Foo.THREE); 21``` 22 23C++ Code 24```cpp 25#include <LuaGlue/LuaGlue.h> 26 27class Foo 28{ 29 public: 30 Foo(int i) { printf("ctor! %i\n", i); } 31 ~Foo(); 32 33 int abc(int a, int b, int c) { printf("%i:%i:%i\n", a,b,c); return 143; } 34 static void aaa() { printf("aaa!\n"); } 35}; 36 37int main(int, char **) 38{ 39 LuaGlue state; 40 41 state. 42 Class<Foo>("Foo"). 43 ctor<int>("new"). 44 method("abc", &Foo::abc). 45 method("aaa", &Foo::aaa). 46 constants( { { "ONE", 1 }, { "TWO", 2.0 }, { "THREE", "three" } } ). 47 end().open().glue(); 48 49 if(!state.doFile("foo.lua")) 50 { 51 printf("failed to dofile: foo.lua\n"); 52 printf("err: %s\n", state.lastError().c_str()); 53 } 54 55 return 0; 56} 57``` 58 59LICENSE 60======= 61 62> Copyright (c) 2013 Thomas Fjellstrom 63> 64> This software is provided 'as-is', without any express or implied 65> warranty. In no event will the authors be held liable for any damages 66> arising from the use of this software. 67 68> Permission is granted to anyone to use this software for any purpose, 69> including commercial applications, and to alter it and redistribute it 70> freely, subject to the following restrictions: 71> 72> 1. The origin of this software must not be misrepresented; you must not 73> claim that you wrote the original software. If you use this software 74> in a product, an acknowledgment in the product documentation would be 75> appreciated but is not required. 76> 77> 2. Altered source versions must be plainly marked as such, and must not be 78> misrepresented as being the original software. 79> 80> 3. This notice may not be removed or altered from any source 81> distribution. 82