├── docs ├── mkdocs │ ├── utilities.md │ ├── state.md │ └── index.md └── output │ ├── img │ └── favicon.ico │ ├── sitemap.xml.gz │ ├── reference │ ├── bc_s.png │ ├── bdwn.png │ ├── doc.png │ ├── docd.png │ ├── open.png │ ├── bc_sd.png │ ├── closed.png │ ├── nav_f.png │ ├── nav_fd.png │ ├── nav_g.png │ ├── nav_h.png │ ├── nav_hd.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_ad.png │ ├── tab_b.png │ ├── tab_bd.png │ ├── tab_h.png │ ├── tab_hd.png │ ├── tab_s.png │ ├── tab_sd.png │ ├── splitbar.png │ ├── splitbard.png │ ├── sync_off.png │ ├── folderclosed.png │ ├── folderopen.png │ ├── index.html │ ├── namespacemembers_enum.html │ ├── luwra_8hpp.html │ ├── structluwra_1_1internal_1_1MemberInfo.html │ ├── structluwra_1_1internal_1_1Wrapper.html │ ├── structluwra_1_1internal_1_1CallableInfo.html │ ├── structluwra_1_1internal_1_1NumericTransportValue.html │ ├── structluwra_1_1internal_1_1__MakeIndexSequence.html │ ├── structluwra_1_1internal_1_1__Match.html │ ├── structluwra_1_1internal_1_1__PrefixOf.html │ ├── structluwra_1_1internal_1_1MemberInfo_3_01Member_01_6_01_4.html │ ├── structluwra_1_1internal_1_1MemberInfo_3_01const_01Member_01_4.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_01Klasss_1_1_5_01_4.html │ ├── structluwra_1_1internal_1_1MemberInfo_3_01Member_01_6_6_01_4.html │ ├── structluwra_1_1internal_1_1MemberInfo_3_01volatile_01Member_01_4.html │ ├── structluwra_1_1internal_1_1CallableInfo_3_01Callable_01_6_01_4.html │ ├── structluwra_1_1internal_1_1CallableInfo_3_01const_01Callable_01_4.html │ ├── structluwra_1_1internal_1_1CallableInfo_3_01Callable_01_6_6_01_4.html │ ├── structluwra_1_1internal_1_1CallableInfo_3_01volatile_01Callable_01_4.html │ ├── structluwra_1_1internal_1_1MemberWrapper.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_07_5_08_07Args_8_8_8_08_4.html │ ├── structluwra_1_1internal_1_1MemberInfo_3_01const_01volatile_01Member_01_4.html │ ├── structluwra_1_1internal_1_1__Match_3_01Compare_00_01TypeList_3_4_00_01TypeList_3_4_01_4.html │ ├── structluwra_1_1internal_1_1CallableInfo_3_01const_01volatile_01Callable_01_4.html │ ├── structluwra_1_1internal_1_1MemberWrapper_3_01Ret_07BaseKlass_1_1_5_08_07Args_8_8_8_08_00_01Klass_01_4.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_07Klasss_1_1_5_08_07Args_8_8_8_08_4.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_07Args_8_8_8_08_4.html │ ├── structluwra_1_1internal_1_1MemberWrapper_3_01Ret_07BaseKlass_1_1_5_08_07Args_8_8_8_08_01const_00_01Klass_01_4.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_07Klasss_1_1_5_08_07Args_8_8_8_08_01const_01_4.html │ ├── structluwra_1_1internal_1_1MemberWrapper_3_01Ret_07BaseKlass_1_1_5_08_07Args_8_8_8_08_01volatile_00_01Klass_01_4.html │ ├── structluwra_1_1internal_1_1__PrefixOf_3_01Compare_00_01TypeList_3_4_00_01TypeList_3_01Types_8_8_8_01_4_01_4.html │ ├── structluwra_1_1ReturnValue-members.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_07Klasss_1_1_5_08_07Args_8_8_8_08_01volatile_01_4.html │ ├── structluwra_1_1internal_1_1MemberWrapper_3_01Ret_07BaseKlass_1_1_5_08_07Args_8_8_8_08_01const_01volatile_00_01Klass_01_4.html │ ├── structluwra_1_1internal_1_1With-members.html │ ├── structluwra_1_1Value_3_01LuaType_01_4-members.html │ ├── structluwra_1_1internal_1_1Wrapper_3_01Ret_07Klasss_1_1_5_08_07Args_8_8_8_08_01const_01volatile_01_4.html │ ├── structluwra_1_1Value_3_01State_01_5_01_4-members.html │ ├── structluwra_1_1Value_3_01CFunction_01_4-members.html │ ├── structluwra_1_1Value_3_01Pushable_01_4-members.html │ ├── structluwra_1_1ReturnValue_3_01Type_01_6_01_4-members.html │ ├── structluwra_1_1ReturnValue_3_01const_01Type_01_4-members.html │ ├── structluwra_1_1internal_1_1__ReadResults-members.html │ ├── structluwra_1_1internal_1_1__ReadResults_3_4-members.html │ ├── structluwra_1_1ReturnValue_3_01Type_01_6_6_01_4-members.html │ ├── structluwra_1_1Value_3_01const_01void_01_5_01_4-members.html │ ├── structluwra_1_1ReturnValue_3_01volatile_01Type_01_4-members.html │ ├── structluwra_1_1internal_1_1UserTypeReg-members.html │ ├── structluwra_1_1internal_1_1__DropFromList-members.html │ ├── structluwra_1_1ReturnValue_3_01const_01volatile_01Type_01_4-members.html │ ├── structluwra_1_1Value_3_01internal_1_1InferValueType_01_4-members.html │ ├── structluwra_1_1Value_3_01std_1_1list_3_01Type_01_4_01_4-members.html │ ├── structluwra_1_1internal_1_1StackMapper-members.html │ ├── structluwra_1_1internal_1_1__StackWalker.html │ ├── dir_97aefd0d527b934f1d99a682da8fe6a9.html │ ├── structluwra_1_1internal_1_1__TuplePusher.html │ ├── structluwra_1_1Value_3_01std_1_1vector_3_01Type_01_4_01_4-members.html │ └── structluwra_1_1internal_1_1__PrefixOf_3_01Compare_00_01TypeList_3_01Prefix_00_01PrefixTail_8_8_8c555b374b101e7a015b8c366d2c54d65.html │ ├── css │ └── fonts │ │ ├── lato-bold.woff │ │ ├── lato-bold.woff2 │ │ ├── lato-normal.woff │ │ ├── lato-normal.woff2 │ │ ├── Roboto-Slab-Bold.woff │ │ ├── lato-bold-italic.woff │ │ ├── Roboto-Slab-Bold.woff2 │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── lato-bold-italic.woff2 │ │ ├── lato-normal-italic.woff │ │ ├── Roboto-Slab-Regular.woff │ │ ├── Roboto-Slab-Regular.woff2 │ │ ├── fontawesome-webfont.woff │ │ ├── fontawesome-webfont.woff2 │ │ └── lato-normal-italic.woff2 │ ├── js │ ├── theme_extra.js │ └── html5shiv.min.js │ └── sitemap.xml ├── tests ├── all.cpp ├── internal │ ├── indexsequence.cpp │ └── typelist.cpp ├── types │ └── reference.cpp ├── functions.cpp ├── tables.cpp └── auxiliary.cpp ├── .gitmodules ├── .gitignore ├── examples ├── playground.cpp ├── state.cpp ├── stack.cpp ├── tables.cpp ├── types.cpp ├── functions.cpp └── usertypes.cpp ├── mkdocs.yml ├── lib ├── luwra.hpp └── luwra │ ├── internal │ ├── common.hpp │ └── indexsequence.hpp │ ├── common.hpp │ └── types │ └── pushable.hpp ├── deps └── install-lua.sh ├── LICENSE ├── .github └── workflows │ └── lua.yml └── Makefile /docs/mkdocs/utilities.md: -------------------------------------------------------------------------------- 1 | # Utilities 2 | Document me, please. 3 | -------------------------------------------------------------------------------- /tests/all.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #include 3 | -------------------------------------------------------------------------------- /docs/mkdocs/state.md: -------------------------------------------------------------------------------- 1 | # State Wrapper 2 | 3 | Document me, please. 4 | -------------------------------------------------------------------------------- /docs/output/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/img/favicon.ico -------------------------------------------------------------------------------- /docs/output/sitemap.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/sitemap.xml.gz -------------------------------------------------------------------------------- /docs/output/reference/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/bc_s.png -------------------------------------------------------------------------------- /docs/output/reference/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/bdwn.png -------------------------------------------------------------------------------- /docs/output/reference/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/doc.png -------------------------------------------------------------------------------- /docs/output/reference/docd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/docd.png -------------------------------------------------------------------------------- /docs/output/reference/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/open.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/catch"] 2 | path = deps/catch 3 | url = https://github.com/philsquared/Catch.git 4 | -------------------------------------------------------------------------------- /docs/output/reference/bc_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/bc_sd.png -------------------------------------------------------------------------------- /docs/output/reference/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/closed.png -------------------------------------------------------------------------------- /docs/output/reference/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/nav_f.png -------------------------------------------------------------------------------- /docs/output/reference/nav_fd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/nav_fd.png -------------------------------------------------------------------------------- /docs/output/reference/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/nav_g.png -------------------------------------------------------------------------------- /docs/output/reference/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/nav_h.png -------------------------------------------------------------------------------- /docs/output/reference/nav_hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/nav_hd.png -------------------------------------------------------------------------------- /docs/output/reference/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/sync_on.png -------------------------------------------------------------------------------- /docs/output/reference/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_a.png -------------------------------------------------------------------------------- /docs/output/reference/tab_ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_ad.png -------------------------------------------------------------------------------- /docs/output/reference/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_b.png -------------------------------------------------------------------------------- /docs/output/reference/tab_bd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_bd.png -------------------------------------------------------------------------------- /docs/output/reference/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_h.png -------------------------------------------------------------------------------- /docs/output/reference/tab_hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_hd.png -------------------------------------------------------------------------------- /docs/output/reference/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_s.png -------------------------------------------------------------------------------- /docs/output/reference/tab_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/tab_sd.png -------------------------------------------------------------------------------- /docs/output/reference/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/splitbar.png -------------------------------------------------------------------------------- /docs/output/reference/splitbard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/splitbard.png -------------------------------------------------------------------------------- /docs/output/reference/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/sync_off.png -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-bold.woff -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-bold.woff2 -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-normal.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-normal.woff -------------------------------------------------------------------------------- /docs/output/reference/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/folderclosed.png -------------------------------------------------------------------------------- /docs/output/reference/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/reference/folderopen.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | examples/*.out 2 | tests/all 3 | docs/html/ 4 | 5 | *.d 6 | *.o 7 | 8 | cpuprofile.pdf 9 | cpuprofile.prof 10 | -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-normal.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-normal.woff2 -------------------------------------------------------------------------------- /docs/output/css/fonts/Roboto-Slab-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/Roboto-Slab-Bold.woff -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-bold-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-bold-italic.woff -------------------------------------------------------------------------------- /docs/output/css/fonts/Roboto-Slab-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/Roboto-Slab-Bold.woff2 -------------------------------------------------------------------------------- /docs/output/css/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/output/css/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-bold-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-bold-italic.woff2 -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-normal-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-normal-italic.woff -------------------------------------------------------------------------------- /docs/output/css/fonts/Roboto-Slab-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/Roboto-Slab-Regular.woff -------------------------------------------------------------------------------- /docs/output/css/fonts/Roboto-Slab-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/Roboto-Slab-Regular.woff2 -------------------------------------------------------------------------------- /docs/output/css/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/output/css/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/output/css/fonts/lato-normal-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vapourismo/luwra/HEAD/docs/output/css/fonts/lato-normal-italic.woff2 -------------------------------------------------------------------------------- /docs/output/js/theme_extra.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Assign 'docutils' class to tables so styling and 3 | * JavaScript behavior is applied. 4 | * 5 | * https://github.com/mkdocs/mkdocs/issues/2028 6 | */ 7 | 8 | $('div.rst-content table').addClass('docutils'); 9 | -------------------------------------------------------------------------------- /examples/playground.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace luwra; 6 | 7 | int main() { 8 | StateWrapper state; 9 | 10 | push(state, 1337); 11 | push(state, 7731, 1337); 12 | 13 | std::cout << read(state, -3) << std::endl 14 | << read(state, -2) << std::endl 15 | << read(state, -1) << std::endl; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /examples/state.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace luwra; 7 | 8 | int main() { 9 | StateWrapper state; 10 | state.loadStandardLibrary(); 11 | 12 | state["foo"] = 1337; 13 | 14 | int r = state.runString( 15 | "print(foo)" 16 | ); 17 | 18 | if (r != LUA_OK) { 19 | std::cerr << state.read(-1) << std::endl; 20 | return 1; 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Luwra 2 | site_description: Minimal-overhead Lua wrapper for C++ 3 | repo_url: https://github.com/vapourismo/luwra 4 | nav: 5 | - 'Home': index.md 6 | - 'Values': values.md 7 | - 'Stack Interaction': stack.md 8 | - 'State Wrapper': state.md 9 | - 'Utilities': utilities.md 10 | - 'Wrapping': wrapping.md 11 | - 'User Types': usertypes.md 12 | theme: readthedocs 13 | docs_dir: docs/mkdocs 14 | site_dir: docs/output 15 | -------------------------------------------------------------------------------- /lib/luwra.hpp: -------------------------------------------------------------------------------- 1 | /* Luwra 2 | * Minimal-overhead Lua wrapper for C++ 3 | * 4 | * Copyright (C) 2016, Ole Krüger 5 | */ 6 | 7 | #ifndef LUWRA_H_ 8 | #define LUWRA_H_ 9 | 10 | #include "luwra/auxiliary.hpp" 11 | #include "luwra/common.hpp" 12 | #include "luwra/stack.hpp" 13 | #include "luwra/state.hpp" 14 | #include "luwra/types/function.hpp" 15 | #include "luwra/types/pushable.hpp" 16 | #include "luwra/types/reference.hpp" 17 | #include "luwra/types/stl.hpp" 18 | #include "luwra/types/table.hpp" 19 | #include "luwra/usertypes.hpp" 20 | #include "luwra/values.hpp" 21 | #include "luwra/wrappers.hpp" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/luwra/internal/common.hpp: -------------------------------------------------------------------------------- 1 | /* Luwra 2 | * Minimal-overhead Lua wrapper for C++ 3 | * 4 | * Copyright (C) 2016, Ole Krüger 5 | */ 6 | 7 | #ifndef LUWRA_INTERNAL_COMMON_H_ 8 | #define LUWRA_INTERNAL_COMMON_H_ 9 | 10 | #include "../common.hpp" 11 | 12 | #include 13 | 14 | #define LUWRA_INTERNAL_NS_BEGIN LUWRA_NS_BEGIN namespace internal { 15 | #define LUWRA_INTERNAL_NS_END LUWRA_NS_END } 16 | 17 | LUWRA_INTERNAL_NS_BEGIN 18 | 19 | // Constructs a type which contains the static constant-expression boolean field 'value'. 20 | template 21 | using BoolConstant = std::integral_constant; 22 | 23 | LUWRA_INTERNAL_NS_END 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /examples/stack.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | static 6 | double sum3(int a, int b, double c) { 7 | return (a + b) * c; 8 | } 9 | 10 | int main() { 11 | luwra::StateWrapper state; 12 | state.loadStandardLibrary(); 13 | 14 | // Build stack 15 | state.push(13); 16 | state.push(37); 17 | state.push(42.2); 18 | 19 | // Each value can be retrieved individually. 20 | std::cout << "a = " << state.read(1) << std::endl; 21 | std::cout << "b = " << state.read(2) << std::endl; 22 | std::cout << "c = " << state.read(3) << std::endl; 23 | 24 | // ... which is a little cumbersome. Instead we might apply a fitting function to our stack. 25 | std::cout << "(a + b) * c = " 26 | << state.apply(1, sum3) 27 | << std::endl; 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /tests/internal/indexsequence.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace luwra::internal; 6 | 7 | TEST_CASE("MakeIndexSequence") { 8 | using Result1 = MakeIndexSequence<0>; 9 | using Expected1 = IndexSequence<>; 10 | 11 | REQUIRE((std::is_same::value)); 12 | 13 | using Result2 = MakeIndexSequence<10>; 14 | using Expected2 = IndexSequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9>; 15 | 16 | REQUIRE((std::is_same::value)); 17 | } 18 | 19 | TEST_CASE("IndexSequence") { 20 | using Subject1 = IndexSequence<0, 1, 2, 3>; 21 | 22 | SECTION("OffsetBy") { 23 | using Result1 = Subject1::OffsetBy<1>; 24 | using Expected1 = IndexSequence<1, 2, 3, 4>; 25 | 26 | REQUIRE((std::is_same::value)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /deps/install-lua.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | install_lua() { 4 | lua_identifier="lua-$LUA_VERSION" 5 | 6 | [[ -e "$lua_identifier.tar.gz" ]] || travis_retry wget -v "http://www.lua.org/ftp/$lua_identifier.tar.gz" 7 | tar xvfz "$lua_identifier.tar.gz" 8 | 9 | pushd "$lua_identifier/src" 10 | 11 | export LUA_LIBNAME="lua-custom" 12 | export LUA_SRCDIR="$(pwd)" 13 | 14 | make LUA_A="lib$LUA_LIBNAME.a" linux 15 | 16 | popd 17 | } 18 | 19 | install_luajit() { 20 | luajit_identifier="LuaJIT-$LUAJIT_VERSION" 21 | 22 | [[ -e "$luajit_identifier.tar.gz" ]] || travis_retry wget -v "http://luajit.org/download/$luajit_identifier.tar.gz" 23 | tar xvfz "$luajit_identifier.tar.gz" 24 | 25 | pushd "$luajit_identifier/src" 26 | 27 | export LUA_LIBNAME="luajit-custom" 28 | export LUA_SRCDIR="$(pwd)" 29 | 30 | make LUAJIT_A="lib$LUA_LIBNAME.a" "lib$LUA_LIBNAME.a" 31 | 32 | popd 33 | } 34 | 35 | mkdir -p deps/download-cache 36 | pushd deps/download-cache 37 | 38 | [[ -n $LUA_VERSION ]] && install_lua 39 | [[ -n $LUAJIT_VERSION ]] && install_luajit 40 | 41 | popd 42 | return 0 43 | -------------------------------------------------------------------------------- /docs/output/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | None 5 | 1980-01-01 6 | daily 7 | 8 | 9 | None 10 | 1980-01-01 11 | daily 12 | 13 | 14 | None 15 | 1980-01-01 16 | daily 17 | 18 | 19 | None 20 | 1980-01-01 21 | daily 22 | 23 | 24 | None 25 | 1980-01-01 26 | daily 27 | 28 | 29 | None 30 | 1980-01-01 31 | daily 32 | 33 | 34 | None 35 | 1980-01-01 36 | daily 37 | 38 | -------------------------------------------------------------------------------- /examples/tables.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | using namespace luwra; 7 | 8 | int main() { 9 | StateWrapper state; 10 | 11 | state["t1"] = MemberMap {}; 12 | 13 | for (int i = 0; i < 10000; i++) { 14 | state["t1"]["value"] = i; 15 | int j = state["t1"]["value"]; 16 | 17 | if (j != i) { 18 | return 1; 19 | } 20 | } 21 | 22 | state.runString("t2 = {a = 13, b = 'Hello'}"); 23 | 24 | state.runString("t2 = {a = 13, b = 'Hello'}"); 25 | Table t2 = state["t2"]; 26 | 27 | LuaType bt = t2["b"]; 28 | if (bt == LuaType::String) { 29 | std::string b = t2["b"]; 30 | std::cout << b << std::endl; 31 | } 32 | 33 | std::map ret = state["t2"]; 34 | for (auto pair: ret) { 35 | std::cout << pair.first << ": "; 36 | LuaType typ = pair.second; 37 | switch (typ) { 38 | case LuaType::Number: 39 | std::cout << pair.second.read(); 40 | break; 41 | 42 | case LuaType::String: 43 | std::cout << pair.second.read(); 44 | break; 45 | 46 | default: 47 | std::cout << "Unknown"; 48 | break; 49 | 50 | } 51 | std::cout << std::endl; 52 | } 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /lib/luwra/common.hpp: -------------------------------------------------------------------------------- 1 | /* Luwra 2 | * Minimal-overhead Lua wrapper for C++ 3 | * 4 | * Copyright (C) 2015, Ole Krüger 5 | */ 6 | 7 | #ifndef LUWRA_COMMON_H_ 8 | #define LUWRA_COMMON_H_ 9 | 10 | extern "C" { 11 | #include 12 | #include 13 | #include 14 | } 15 | 16 | // Check for proper Lua version 17 | #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM >= 600 18 | #error Luwra has not been tested against your installed version of Lua 19 | #endif 20 | 21 | // Namespaces 22 | #define LUWRA_NS_BEGIN namespace luwra { 23 | #define LUWRA_NS_END } 24 | 25 | // Version MAJOR.MINOR.PATCH 26 | #define LUWRA_VERSION_MAJOR 0 27 | #define LUWRA_VERSION_MINOR 5 28 | #define LUWRA_VERSION_PATCH 1 29 | 30 | // LUA_OK does not exist in Lua 5.1 and earlier 31 | #ifndef LUA_OK 32 | #define LUA_OK 0 33 | #endif 34 | 35 | // Because VS C++ 36 | #ifdef _MSC_VER 37 | #define __LUWRA_NS_RESOLVE(a, b) a::##b 38 | #else 39 | #define __LUWRA_NS_RESOLVE(a, b) a::b 40 | #endif 41 | 42 | LUWRA_NS_BEGIN 43 | 44 | // Lua aliases 45 | using Integer = lua_Integer; 46 | using Number = lua_Number; 47 | using State = lua_State; 48 | using CFunction = lua_CFunction; 49 | 50 | LUWRA_NS_END 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /lib/luwra/internal/indexsequence.hpp: -------------------------------------------------------------------------------- 1 | /* Luwra 2 | * Minimal-overhead Lua wrapper for C++ 3 | * 4 | * Copyright (C) 2016, Ole Krüger 5 | */ 6 | 7 | #ifndef LUWRA_INTERNAL_INDEXSEQUENCE_H_ 8 | #define LUWRA_INTERNAL_INDEXSEQUENCE_H_ 9 | 10 | #include "common.hpp" 11 | 12 | LUWRA_INTERNAL_NS_BEGIN 13 | 14 | // Capture a list of indices. 15 | template 16 | struct IndexSequence { 17 | template 18 | using OffsetBy = IndexSequence<(Seq + Offset)...>; 19 | 20 | template