├── .clang-format ├── .dockerignore ├── .github ├── ISSUE_TEMPLATE.md └── workflows │ ├── macos.yml │ ├── ubuntu.yml │ └── windows.yml ├── .gitignore ├── .style.yapf ├── CMakeLists.txt ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── Dockerfile ├── LICENSE.txt ├── README.md ├── cmake ├── Includes │ └── Project.cmake ├── Modules │ ├── CheckCompilerDiagnostic.cmake │ ├── CheckCompilerFlag.cmake │ ├── Common │ │ └── Core.cmake │ └── FindVersion.cmake ├── Packages │ ├── FindKaguyaBuild.cmake │ ├── FindLua │ │ ├── set_version_vars.cmake │ │ └── version_check.cmake │ ├── FindLuaBridgeBuild.cmake │ ├── FindLuaBuild.cmake │ ├── FindLuaBuild │ │ ├── LuaJIT.cmake │ │ └── LuaVanilla.cmake │ ├── FindLuwraBuild.cmake │ ├── FindSphinx.cmake │ └── FindToLuappBuild.cmake └── sol2-config.cmake.in ├── documentation ├── .clang-format ├── CMakeLists.txt ├── Doxyfile.in ├── Makefile ├── make.bat ├── presentations │ ├── 2016.10.14 - ThePhD - No Overhead C Abstraction.pdf │ ├── 2017.11.08 - ThePhD - Wrapping Lua C in C++.pdf │ ├── 2018.02.06 - ThePhD - Biting the CMake Bullet.pdf │ ├── 2018.05.10 - ThePhD - Compile Fast, Run Faster, Scale Forever.pdf │ ├── 2018.09.28 - ThePhD - Scripting at the Speed of Thought.pdf │ └── 2019.05.10 - ThePhD - The Plan for Tomorrow - Compile-Time Extension Points in C++.pdf ├── requirements.txt └── source │ ├── _themes │ └── sol2 │ │ ├── layout.html │ │ ├── static │ │ ├── search-fix.js_t │ │ └── sol2.css_t │ │ └── theme.conf │ ├── api │ ├── api-top.rst │ ├── as_args.rst │ ├── as_container.rst │ ├── as_function.rst │ ├── as_returns.rst │ ├── as_table.rst │ ├── c_call.rst │ ├── compatibility.rst │ ├── coroutine.rst │ ├── environment.rst │ ├── error.rst │ ├── function.rst │ ├── lua_value.rst │ ├── make_reference.rst │ ├── metatable_key.rst │ ├── nested.rst │ ├── new_table.rst │ ├── object.rst │ ├── optional.rst │ ├── overload.rst │ ├── policies.rst │ ├── property.rst │ ├── protect.rst │ ├── protected_function.rst │ ├── proxy.rst │ ├── readonly.rst │ ├── reference.rst │ ├── resolve.rst │ ├── stack.rst │ ├── stack_reference.rst │ ├── state.rst │ ├── table.rst │ ├── table_traversal_keys.rst │ ├── this_environment.rst │ ├── this_state.rst │ ├── thread.rst │ ├── tie.rst │ ├── types.rst │ ├── unique_usertype_traits.rst │ ├── user.rst │ ├── userdata.rst │ ├── usertype.rst │ ├── usertype_memory.rst │ ├── var.rst │ ├── variadic_args.rst │ ├── variadic_results.rst │ └── yielding.rst │ ├── benchmarks.rst │ ├── build.rst │ ├── codecvt.rst │ ├── compilation.rst │ ├── conf.py │ ├── containers.rst │ ├── errors.rst │ ├── exceptions.rst │ ├── features.rst │ ├── functions.rst │ ├── index.rst │ ├── licenses.rst │ ├── media │ ├── Ko-fi_Blue.png │ ├── become_a_patron_button.png │ ├── bench │ │ ├── base_derived.png │ │ ├── c_function.png │ │ ├── c_function_through_lua_in_c.png │ │ ├── implicit_inheritance.png │ │ ├── lua_bindings_shootout.json │ │ ├── lua_function_in_c.png │ │ ├── member_function_call.png │ │ ├── multi_return.png │ │ ├── multi_return_lua.png │ │ ├── optional_failure.png │ │ ├── optional_half_failure.png │ │ ├── optional_success.png │ │ ├── return_userdata.png │ │ ├── stateful_function_object.png │ │ ├── table_chained_get.png │ │ ├── table_chained_set.png │ │ ├── table_get.png │ │ ├── table_global_string_get.png │ │ ├── table_global_string_set.png │ │ ├── table_set.png │ │ ├── userdata_variable_access.png │ │ ├── userdata_variable_access_large.png │ │ └── userdata_variable_access_last.png │ ├── discord_logo_wordmark.png │ ├── eevee_code_after.jpg │ ├── eevee_code_before.jpg │ ├── github_logo.png │ ├── github_sponsors_logo.png │ ├── liberapay_logo.png │ ├── pp_cc_mark_111x69.jpg │ ├── sol.png │ └── sol.psd │ ├── mentions.rst │ ├── origin.rst │ ├── performance.rst │ ├── rtti.rst │ ├── safety.rst │ ├── threading.rst │ ├── traits.rst │ ├── tutorial │ ├── all-the-things.rst │ ├── customization.rst │ ├── cxx-in-lua.rst │ ├── existing.rst │ ├── functions.rst │ ├── getting-started.rst │ ├── ownership.rst │ ├── tutorial-top.rst │ └── variables.rst │ └── usertypes.rst ├── examples ├── .clang-format ├── CMakeLists.txt ├── customization │ ├── CMakeLists.txt │ ├── include │ │ ├── entity.hpp │ │ ├── lua_interop.hpp │ │ ├── lua_zm_interop.hpp │ │ └── zm │ │ │ └── vec3.hpp │ └── source │ │ ├── lua_interop.cpp │ │ ├── lua_zm_interop.cpp │ │ └── main.cpp ├── interop │ ├── LuaBridge │ │ ├── CMakeLists.txt │ │ └── source │ │ │ └── LuaBridge.cpp │ ├── kaguya │ │ ├── CMakeLists.txt │ │ └── source │ │ │ └── kaguya.cpp │ ├── luwra │ │ ├── CMakeLists.txt │ │ └── source │ │ │ └── luwra.cpp │ └── tolua │ │ ├── CMakeLists.txt │ │ └── source │ │ ├── Player.h │ │ ├── Player.pkg │ │ ├── tolua.cpp │ │ └── tolua_Player.h ├── require_dll_example │ ├── CMakeLists.txt │ ├── include │ │ └── my_object │ │ │ ├── my_object.hpp │ │ │ └── my_object_api.hpp │ └── source │ │ ├── my_object.cpp │ │ └── require_from_dll.cpp └── source │ ├── allocation_limit.cpp │ ├── any_return.cpp │ ├── args_from_container.cpp │ ├── as_returns.cpp │ ├── basic.cpp │ ├── c_array.cpp │ ├── c_call.cpp │ ├── calling_lua_functions.cpp │ ├── config.cpp │ ├── config.lua │ ├── container_usertype_as_container.cpp │ ├── container_with_pairs.cpp │ ├── containers.cpp │ ├── containers_as_table.cpp │ ├── coroutine.cpp │ ├── coroutine_multiple_stacks.cpp │ ├── coroutine_state.cpp │ ├── custom_reader.cpp │ ├── customization_base_object_catch.cpp │ ├── customization_convert_on_get.cpp │ ├── customization_global_transparent_argument.cpp │ ├── customization_multiple.cpp │ ├── docs │ ├── as_function.cpp │ ├── as_function_usertype_member_variable.cpp │ ├── as_table_ipairs.cpp │ ├── coroutine_main.cpp │ ├── coroutine_thread.cpp │ ├── inheritance.cpp │ ├── my_panic.cpp │ ├── preparing_environments.cpp │ ├── references_in_lambdas.cpp │ ├── runtime_extension.cpp │ ├── simple_functions.cpp │ ├── simple_structs.cpp │ ├── state_script_safe.cpp │ ├── state_transfer.cpp │ └── std_thread.cpp │ ├── dump.cpp │ ├── dynamic_object.cpp │ ├── environment_snooping.cpp │ ├── environment_state.cpp │ ├── environment_state_2.cpp │ ├── environments.cpp │ ├── environments_on_functions.cpp │ ├── error_handler.cpp │ ├── exception_handler.cpp │ ├── functions.cpp │ ├── functions_empty_arguments.cpp │ ├── index_and_newindex_usertype.cpp │ ├── indirect_function_calls.cpp │ ├── lua_stream.cpp │ ├── lua_value.cpp │ ├── metatable_customization.cpp │ ├── metatable_key_low_level.cpp │ ├── multi_results.cpp │ ├── optional_with_iteration.cpp │ ├── overloading.cpp │ ├── overloading_with_fallback.cpp │ ├── overloading_with_members.cpp │ ├── overridable_function_members.cpp │ ├── pairs.cpp │ ├── pairs_with_raw_functions.cpp │ ├── player_script.lua │ ├── property.cpp │ ├── protect.cpp │ ├── protected_functions.cpp │ ├── read_only.cpp │ ├── require.cpp │ ├── require_override_behavior.cpp │ ├── runtime_additions.cpp │ ├── script_error_handling.cpp │ ├── self_from_lua.cpp │ ├── shared_ptr.cpp │ ├── shared_ptr_inheritance.cpp │ ├── shared_ptr_modify_in_place.cpp │ ├── singleton.cpp │ ├── stack_aligned_function.cpp │ ├── stack_aligned_stack_handler_function.cpp │ ├── static_variables.cpp │ ├── table_as_container.cpp │ ├── table_create_if_nil.cpp │ ├── table_proxy.cpp │ ├── tables.cpp │ ├── this_state.cpp │ ├── tie.cpp │ ├── tutorials │ ├── erase_demo.cpp │ ├── first_snippet.cpp │ ├── lazy_demo.cpp │ ├── multiple_return.cpp │ ├── object_lifetime.cpp │ ├── open_multiple_libraries.cpp │ ├── pointer_lifetime.cpp │ ├── quick_n_dirty │ │ ├── arguments_to_scripts.cpp │ │ ├── functions_all.cpp │ │ ├── functions_easy.cpp │ │ ├── make_tables.cpp │ │ ├── multiple_returns_from_lua.cpp │ │ ├── multiple_returns_to_lua.cpp │ │ ├── namespacing.cpp │ │ ├── opening_a_state.cpp │ │ ├── opening_state_on_raw_lua.cpp │ │ ├── running_lua_code.cpp │ │ ├── running_lua_code_low_level.cpp │ │ ├── running_lua_code_safely.cpp │ │ ├── self_call.cpp │ │ ├── set_and_get_variables.cpp │ │ ├── set_and_get_variables_exists.cpp │ │ ├── tables_and_nesting.cpp │ │ ├── userdata.cpp │ │ ├── userdata_memory_reference.cpp │ │ └── usertypes.cpp │ ├── reading_functions.cpp │ ├── variables_demo.cpp │ ├── write_variables_demo.cpp │ ├── writing_functions.cpp │ ├── writing_member_functions.cpp │ ├── writing_overloaded_template_functions.cpp │ └── writing_template_functions.cpp │ ├── unique_ptr.cpp │ ├── usertype.cpp │ ├── usertype_advanced.cpp │ ├── usertype_automatic_operators.cpp │ ├── usertype_basics.cpp │ ├── usertype_bitfields.cpp │ ├── usertype_call_from_c++.cpp │ ├── usertype_constructors.cpp │ ├── usertype_dynamic_get_set.cpp │ ├── usertype_initializers.cpp │ ├── usertype_special_functions.cpp │ ├── usertype_var.cpp │ ├── variables.cpp │ ├── variadic_args.cpp │ ├── variadic_args_into_lua.cpp │ ├── variadic_args_shifted.cpp │ ├── variadic_args_storage.cpp │ └── wip │ └── lua_inheritance.cpp ├── include └── sol │ ├── abort.hpp │ ├── as_args.hpp │ ├── as_returns.hpp │ ├── assert.hpp │ ├── base_traits.hpp │ ├── bind_traits.hpp │ ├── bytecode.hpp │ ├── call.hpp │ ├── compatibility.hpp │ ├── compatibility │ ├── compat-5.3.c.h │ ├── compat-5.3.h │ ├── compat-5.4.h │ └── lua_version.hpp │ ├── config.hpp │ ├── coroutine.hpp │ ├── debug.hpp │ ├── demangle.hpp │ ├── deprecate.hpp │ ├── detail │ └── build_version.hpp │ ├── dump_handler.hpp │ ├── ebco.hpp │ ├── environment.hpp │ ├── epilogue.hpp │ ├── error.hpp │ ├── error_handler.hpp │ ├── forward.hpp │ ├── forward_as.hpp │ ├── forward_detail.hpp │ ├── function.hpp │ ├── function_result.hpp │ ├── function_types.hpp │ ├── function_types_core.hpp │ ├── function_types_overloaded.hpp │ ├── function_types_stateful.hpp │ ├── function_types_stateless.hpp │ ├── function_types_templated.hpp │ ├── in_place.hpp │ ├── inheritance.hpp │ ├── load_result.hpp │ ├── lua_table.hpp │ ├── lua_value.hpp │ ├── make_reference.hpp │ ├── metatable.hpp │ ├── object.hpp │ ├── object_base.hpp │ ├── optional.hpp │ ├── optional_implementation.hpp │ ├── overload.hpp │ ├── packaged_coroutine.hpp │ ├── pairs_iterator.hpp │ ├── pointer_like.hpp │ ├── policies.hpp │ ├── prologue.hpp │ ├── property.hpp │ ├── protect.hpp │ ├── protected_function.hpp │ ├── protected_function_result.hpp │ ├── protected_handler.hpp │ ├── proxy_base.hpp │ ├── raii.hpp │ ├── reference.hpp │ ├── resolve.hpp │ ├── sol.hpp │ ├── stack.hpp │ ├── stack │ └── detail │ │ └── pairs.hpp │ ├── stack_check.hpp │ ├── stack_check_get.hpp │ ├── stack_check_get_qualified.hpp │ ├── stack_check_get_unqualified.hpp │ ├── stack_check_qualified.hpp │ ├── stack_check_unqualified.hpp │ ├── stack_core.hpp │ ├── stack_field.hpp │ ├── stack_get.hpp │ ├── stack_get_qualified.hpp │ ├── stack_get_unqualified.hpp │ ├── stack_guard.hpp │ ├── stack_iterator.hpp │ ├── stack_pop.hpp │ ├── stack_probe.hpp │ ├── stack_proxy.hpp │ ├── stack_proxy_base.hpp │ ├── stack_push.hpp │ ├── stack_reference.hpp │ ├── state.hpp │ ├── state_handling.hpp │ ├── state_view.hpp │ ├── string_view.hpp │ ├── table.hpp │ ├── table_core.hpp │ ├── table_iterator.hpp │ ├── table_proxy.hpp │ ├── thread.hpp │ ├── tie.hpp │ ├── traits.hpp │ ├── trampoline.hpp │ ├── tuple.hpp │ ├── types.hpp │ ├── unicode.hpp │ ├── unique_usertype_traits.hpp │ ├── unreachable.hpp │ ├── unsafe_function.hpp │ ├── unsafe_function_result.hpp │ ├── userdata.hpp │ ├── usertype.hpp │ ├── usertype_container.hpp │ ├── usertype_container_launch.hpp │ ├── usertype_core.hpp │ ├── usertype_proxy.hpp │ ├── usertype_storage.hpp │ ├── usertype_traits.hpp │ ├── utility │ ├── is_integer.hpp │ └── to_string.hpp │ ├── variadic_args.hpp │ ├── variadic_results.hpp │ ├── version.hpp │ └── wrapper.hpp ├── list_headers.py ├── meson.build ├── meson_options.txt ├── scripts ├── build.linux.sh ├── preparation.linux.sh ├── preparation.osx.sh ├── push.linux.sh ├── run.linux.sh └── run.osx.sh ├── single ├── CMakeLists.txt └── single.py ├── sol2.natvis ├── sol2.pc.in ├── subprojects └── lua.wrap └── tests ├── CMakeLists.txt ├── config_tests ├── CMakeLists.txt ├── function_pointers │ ├── CMakeLists.txt │ └── source │ │ ├── main.cpp │ │ └── retrieval.cpp └── integer_value_fits │ ├── CMakeLists.txt │ └── source │ ├── main.cpp │ └── negative_size_t.cpp ├── container_exhaustive ├── CMakeLists.txt └── source │ ├── exhaustive.cpp │ └── main.cpp ├── coroutines ├── CMakeLists.txt └── source │ ├── array_proxy_lifetime.cpp │ ├── main.cpp │ └── properties_lifetime.cpp ├── enum ├── CMakeLists.txt └── source │ ├── main.cpp │ └── read_only_iteration.cpp ├── environment ├── CMakeLists.txt └── source │ ├── get.cpp │ ├── main.cpp │ ├── sandboxing.cpp │ ├── shadowing.cpp │ └── this_environment.cpp ├── exceptions ├── CMakeLists.txt └── source │ ├── functions.cpp │ ├── functions.noexcept.cpp │ ├── functions.yielding.cpp │ ├── main.cpp │ ├── usertypes.cpp │ └── usertypes.yielding.cpp ├── inclusion ├── CMakeLists.txt └── source │ ├── as_args.cpp │ ├── as_returns.cpp │ ├── base_traits.cpp │ ├── bind_traits.cpp │ ├── bytecode.cpp │ ├── call.cpp │ ├── compatibility.cpp │ ├── compatibility │ ├── compat-5.3.cpp │ └── lua_version.cpp │ ├── config.cpp │ ├── coroutine.cpp │ ├── debug.cpp │ ├── demangle.cpp │ ├── deprecate.cpp │ ├── detail │ └── build_version.cpp │ ├── ebco.cpp │ ├── environment.cpp │ ├── error.cpp │ ├── error_handler.cpp │ ├── forward.cpp │ ├── forward_detail.cpp │ ├── function.cpp │ ├── function_result.cpp │ ├── function_types.cpp │ ├── function_types_core.cpp │ ├── function_types_overloaded.cpp │ ├── function_types_stateful.cpp │ ├── function_types_stateless.cpp │ ├── function_types_templated.cpp │ ├── in_place.cpp │ ├── inheritance.cpp │ ├── load_result.cpp │ ├── lua_table.cpp │ ├── lua_value.cpp │ ├── main.cpp │ ├── make_reference.cpp │ ├── metatable.cpp │ ├── object.cpp │ ├── object_base.cpp │ ├── optional.cpp │ ├── optional_implementation.cpp │ ├── overload.cpp │ ├── packaged_coroutine.cpp │ ├── pairs_iterator.cpp │ ├── pointer_like.cpp │ ├── policies.cpp │ ├── property.cpp │ ├── protect.cpp │ ├── protected_function.cpp │ ├── protected_function_result.cpp │ ├── protected_handler.cpp │ ├── proxy.cpp │ ├── proxy_base.cpp │ ├── raii.cpp │ ├── reference.cpp │ ├── resolve.cpp │ ├── sol.cpp │ ├── stack.cpp │ ├── stack │ └── detail │ │ └── pairs.cpp │ ├── stack_check.cpp │ ├── stack_check_get.cpp │ ├── stack_check_get_qualified.cpp │ ├── stack_check_get_unqualified.cpp │ ├── stack_check_qualified.cpp │ ├── stack_check_unqualified.cpp │ ├── stack_core.cpp │ ├── stack_field.cpp │ ├── stack_get.cpp │ ├── stack_get_qualified.cpp │ ├── stack_get_unqualified.cpp │ ├── stack_guard.cpp │ ├── stack_iterator.cpp │ ├── stack_pop.cpp │ ├── stack_probe.cpp │ ├── stack_proxy.cpp │ ├── stack_proxy_base.cpp │ ├── stack_push.cpp │ ├── stack_reference.cpp │ ├── state.cpp │ ├── state_handling.cpp │ ├── state_view.cpp │ ├── string_view.cpp │ ├── table.cpp │ ├── table_core.cpp │ ├── table_iterator.cpp │ ├── thread.cpp │ ├── tie.cpp │ ├── traits.cpp │ ├── trampoline.cpp │ ├── tuple.cpp │ ├── types.cpp │ ├── unicode.cpp │ ├── unique_usertype_traits.cpp │ ├── unsafe_function.cpp │ ├── unsafe_function_result.cpp │ ├── userdata.cpp │ ├── usertype.cpp │ ├── usertype_container.cpp │ ├── usertype_container_launch.cpp │ ├── usertype_core.cpp │ ├── usertype_proxy.cpp │ ├── usertype_storage.cpp │ ├── usertype_traits.cpp │ ├── utility │ ├── is_integer.cpp │ └── to_string.cpp │ ├── variadic_args.cpp │ ├── variadic_results.cpp │ ├── version.cpp │ └── wrapper.cpp ├── lua_lifetime ├── CMakeLists.txt └── source │ └── main.cpp ├── numerics ├── CMakeLists.txt └── source │ ├── large.cpp │ └── main.cpp ├── regression_tests ├── 1011 │ ├── CMakeLists.txt │ └── source │ │ └── 1011 - release mode crash MSVC.cpp ├── CMakeLists.txt └── simple │ ├── CMakeLists.txt │ └── source │ ├── 1000 - readonly warning.cpp │ ├── 1008 - as_function binding triggers correctly.cpp │ ├── 1067 - optional bindings.cpp │ ├── 1072 - capture exception propagation.cpp │ ├── 1087 - readonly property error checking.cpp │ ├── 1095 - raw_get from global table fails.cpp │ ├── 1096 - functions binding wrong.cpp │ ├── 1144 - type destructed from non-destructed memory.cpp │ ├── 1149 - static method gets const-morphed in internals.cpp │ ├── 1192 - incorrect alignment calculation.cpp │ ├── 1211 - protected_function_result nullptr.cpp │ ├── 1266 - add method in Lua 5.4 showing freelist.cpp │ ├── 1315 - keep-alive memory.cpp │ └── main.cpp ├── run_time ├── CMakeLists.txt └── source │ ├── basic.cpp │ ├── common_classes.hpp │ ├── container.usertype_check.cpp │ ├── container_semantics.cpp │ ├── container_semantics.custom.cpp │ ├── container_semantics.ordered.cpp │ ├── container_semantics.unordered.cpp │ ├── container_shims.cpp │ ├── container_table.cpp │ ├── containers.cpp │ ├── containers.roundtrip.cpp │ ├── containers.table.cpp │ ├── coroutines.cpp │ ├── customizations.cpp │ ├── customizations_private.cpp │ ├── dump.cpp │ ├── functions.cpp │ ├── functions.std.cpp │ ├── gc.cpp │ ├── lua_value.cpp │ ├── main.cpp │ ├── operators.cpp │ ├── overflow.cpp │ ├── plain_types.cpp │ ├── policies.cpp │ ├── proxies.cpp │ ├── sol_test.hpp │ ├── state.cpp │ ├── storage.cpp │ ├── strings.cpp │ ├── tables.checks.cpp │ ├── tables.clear.cpp │ ├── tables.cpp │ ├── tables.enums.cpp │ ├── tables.indexing.cpp │ ├── tables.insertion.cpp │ ├── tables.traversal.cpp │ ├── usertypes.auxiliary_keys.cpp │ ├── usertypes.basic.cpp │ ├── usertypes.constructors.cpp │ ├── usertypes.cpp │ ├── usertypes.inheritance.cpp │ ├── usertypes.inheritance.multi.cpp │ ├── usertypes.member_variables.cpp │ ├── usertypes.overload.cpp │ ├── usertypes.properties.cpp │ ├── usertypes.runtime.cpp │ ├── usertypes.unique.cpp │ ├── usertypes.unregister.cpp │ ├── utility.cpp │ └── variadics.cpp └── utility ├── CMakeLists.txt └── source ├── is_integer.cpp ├── main.cpp └── to_string.cpp /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Read these guidelines. They are relatively simple and will allow me to help you better! 2 | 3 | For Error Reports: 4 | 5 | 1. Produce a simple, short, compilable test case that reproduces your problem. 6 | 2. Make a descriptive title that summarises the bug as a whole. 7 | 3. Explain the bug in as much detail as you can in the body of the issue. 8 | 4. Include Compiler/IDE (Visual Studio, XCode...), Build and Deployment System, Language (C++, Objective-C++), and any special defines you have set. 9 | 10 | If you want to request a feature: 11 | 12 | 1. Produce any relevant imaginary code that illustrates what you would like or desired behavior. 13 | 2. Include a description and title of what you would like. 14 | 3. Annotate and describe the behavior through comments, asserts or just a small write up. 15 | 16 | Thanks for helping sol2 grow! 17 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: Mac OS 2 | 3 | on: [push] 4 | 5 | env: 6 | CTEST_OUTPUT_ON_FAILURE: 1 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: macos-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | submodules: recursive 17 | 18 | - name: configure 19 | run: | 20 | cmake -B build/debug -D CMAKE_BUILD_TYPE:STRING=Debug "-DSOL2_LUA_VERSION:STRING=5.4" -DSOL2_PLATFORM:STRING=x64 -DSOL2_CI=ON -DSOL2_BUILD_LUA:BOOL=ON -DBUILD_LUA_AS_DLL:BOOL=OFF -DSOL2_TESTS:BOOL=ON -DSOL2_EXAMPLES:BOOL=ON -DSOL2_TESTS_EXAMPLES:BOOL=ON 21 | cmake -B build/release -D CMAKE_BUILD_TYPE:STRING=Release "-DSOL2_LUA_VERSION:STRING=5.4" -DSOL2_PLATFORM:STRING=x64 -DSOL2_CI=ON -DSOL2_BUILD_LUA:BOOL=ON -DBUILD_LUA_AS_DLL:BOOL=OFF -DSOL2_TESTS:BOOL=ON -DSOL2_EXAMPLES:BOOL=ON -DSOL2_TESTS_EXAMPLES:BOOL=ON 22 | - name: build 23 | run: | 24 | cmake --build build/debug --config Debug 25 | cmake --build build/release --config Release 26 | - name: test 27 | run: | 28 | cd build/debug 29 | ctest --build-config Debug 30 | cd ../.. 31 | cd build/release 32 | ctest --build-config Release 33 | cd ../.. 34 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu.yml: -------------------------------------------------------------------------------- 1 | name: Ubuntu 2 | 3 | on: [push] 4 | 5 | env: 6 | CTEST_OUTPUT_ON_FAILURE: 1 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | submodules: recursive 17 | 18 | - name: configure 19 | run: | 20 | cmake -B build/debug -D CMAKE_BUILD_TYPE:STRING=Debug "-DSOL2_LUA_VERSION:STRING=5.4" -DSOL2_PLATFORM:STRING=x64 -DSOL2_CI=ON -DSOL2_BUILD_LUA:BOOL=ON -DBUILD_LUA_AS_DLL:BOOL=OFF -DSOL2_TESTS:BOOL=ON -DSOL2_EXAMPLES:BOOL=ON -DSOL2_TESTS_EXAMPLES:BOOL=ON 21 | cmake -B build/release -D CMAKE_BUILD_TYPE:STRING=Release "-DSOL2_LUA_VERSION:STRING=5.4" -DSOL2_PLATFORM:STRING=x64 -DSOL2_CI=ON -DSOL2_BUILD_LUA:BOOL=ON -DBUILD_LUA_AS_DLL:BOOL=OFF -DSOL2_TESTS:BOOL=ON -DSOL2_EXAMPLES:BOOL=ON -DSOL2_TESTS_EXAMPLES:BOOL=ON 22 | - name: build 23 | run: | 24 | cmake --build build/debug --config Debug 25 | cmake --build build/release --config Release 26 | - name: test 27 | run: | 28 | cd build/debug 29 | ctest --build-config Debug 30 | cd ../.. 31 | cd build/release 32 | ctest --build-config Release 33 | cd ../.. 34 | -------------------------------------------------------------------------------- /.style.yapf: -------------------------------------------------------------------------------- 1 | [style] 2 | based_on_style = pep8 3 | use_tabs = true 4 | indent_width = 5 5 | 6 | spaces_before_comment = 1 7 | spaces_around_power_operator = true 8 | space_between_ending_comma_and_closing_bracket = true 9 | 10 | continuation_align_style = SPACE 11 | split_before_first_argument = false 12 | split_complex_comprehension = true 13 | dedent_closing_brackets = false 14 | coalesce_brackets = true 15 | align_closing_bracket_with_visual_indent = false 16 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # 🎉 Donators! ♥ 🎉 2 | 3 | Thank you to all patrons, donators and contributors who help keep sol2 amazing. 4 | 5 | - Robert Salvet 6 | - Ορφέας Ζαφείρης - 2x Donations! 7 | - Michael Wallar 8 | - Johannes Schultz 9 | - Elias Daler 10 | - BECKMANN & EGLE Industrieelektronik GmbH [bue.de](https://www.bue.de/) 11 | 12 | 13 | # 🎉 Patrons! ♥ 🎉 14 | 15 | Beyond just a one-time donation, patrons make a continued commitment to help keep sol2 supported and bug-free. Thank you for your patronage! Here are the supporters that wanted to be featured as sol2 contributors. 16 | 17 | - Joel Falcou 18 | - Michael Caisse 19 | - Joshua Fisher 20 | - Ορφέας Ζαφείρης 21 | 22 | 23 | # Company Patrons / Supporters # 24 | 25 | Companies who sign up for a long-term support contract or patronage are listed here! They really push forward what's possible with sol2 (and the newer v3)! Please reach out to phdofthehouse@gmail.com if you are interested in a custom solution or a long-term support contract that goes beyond the current release's needs! 26 | 27 | - Intrepid Control Systems [intrepidcs.com](https://www.intrepidcs.com/) 28 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2022 Rapptz, ThePhD, and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /documentation/presentations/2016.10.14 - ThePhD - No Overhead C Abstraction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/presentations/2016.10.14 - ThePhD - No Overhead C Abstraction.pdf -------------------------------------------------------------------------------- /documentation/presentations/2017.11.08 - ThePhD - Wrapping Lua C in C++.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/presentations/2017.11.08 - ThePhD - Wrapping Lua C in C++.pdf -------------------------------------------------------------------------------- /documentation/presentations/2018.02.06 - ThePhD - Biting the CMake Bullet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/presentations/2018.02.06 - ThePhD - Biting the CMake Bullet.pdf -------------------------------------------------------------------------------- /documentation/presentations/2018.05.10 - ThePhD - Compile Fast, Run Faster, Scale Forever.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/presentations/2018.05.10 - ThePhD - Compile Fast, Run Faster, Scale Forever.pdf -------------------------------------------------------------------------------- /documentation/presentations/2018.09.28 - ThePhD - Scripting at the Speed of Thought.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/presentations/2018.09.28 - ThePhD - Scripting at the Speed of Thought.pdf -------------------------------------------------------------------------------- /documentation/presentations/2019.05.10 - ThePhD - The Plan for Tomorrow - Compile-Time Extension Points in C++.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/presentations/2019.05.10 - ThePhD - The Plan for Tomorrow - Compile-Time Extension Points in C++.pdf -------------------------------------------------------------------------------- /documentation/requirements.txt: -------------------------------------------------------------------------------- 1 | breathe 2 | cmake 3 | ninja 4 | -------------------------------------------------------------------------------- /documentation/source/_themes/sol2/layout.html: -------------------------------------------------------------------------------- 1 | {%- extends "haiku/layout.html" %} 2 | 3 | {% set script_files = script_files + ["_static/search-fix.js"] %} 4 | 5 | {% block haikuheader %} 6 |
7 | {{ super() }} 8 |
9 |
10 |

Search the Documentation

11 |
12 | 13 | 14 |
15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /documentation/source/_themes/sol2/static/sol2.css_t: -------------------------------------------------------------------------------- 1 | @import url('haiku.css'); 2 | 3 | .header-left { 4 | float: left; 5 | display: inline-block; 6 | vertical-align: top; 7 | } 8 | 9 | .header-right { 10 | float: right; 11 | display: inline-block; 12 | vertical-align: top; 13 | } 14 | 15 | .header-right h3 { 16 | margin: 0; 17 | padding-top: 15px; 18 | } -------------------------------------------------------------------------------- /documentation/source/_themes/sol2/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = haiku 3 | stylesheet = sol2.css 4 | pygments_style = autumn -------------------------------------------------------------------------------- /documentation/source/api/api-top.rst: -------------------------------------------------------------------------------- 1 | api reference manual 2 | ==================== 3 | 4 | Browse the various function and classes :doc:`sol<../index>` utilizes to make your life easier when working with Lua. 5 | 6 | 7 | .. toctree:: 8 | :caption: sol API 9 | :name: apitoc 10 | :maxdepth: 2 11 | 12 | state 13 | this_state 14 | lua_value 15 | reference 16 | stack_reference 17 | make_reference 18 | table 19 | table_traversal_keys 20 | userdata 21 | environment 22 | this_environment 23 | proxy 24 | as_container 25 | nested 26 | as_table 27 | usertype 28 | usertype_memory 29 | unique_usertype_traits 30 | tie 31 | function 32 | protected_function 33 | coroutine 34 | yielding 35 | error 36 | object 37 | thread 38 | optional 39 | variadic_args 40 | variadic_results 41 | as_args 42 | as_returns 43 | overload 44 | property 45 | var 46 | protect 47 | policies 48 | readonly 49 | as_function 50 | c_call 51 | resolve 52 | stack 53 | user 54 | compatibility 55 | types 56 | metatable_key 57 | new_table 58 | -------------------------------------------------------------------------------- /documentation/source/api/as_args.rst: -------------------------------------------------------------------------------- 1 | as_args 2 | ======= 3 | *turn an iterable argument into multiple arguments* 4 | 5 | 6 | .. code-block:: cpp 7 | 8 | template 9 | struct as_args_t { ... }; 10 | 11 | template 12 | as_args_t as_args( T&& ); 13 | 14 | 15 | ``sol::as_args`` is a function that that takes an iterable and turns it into multiple arguments to a function call. It forwards its arguments, and is meant to be used as shown below: 16 | 17 | 18 | .. literalinclude:: ../../../examples/source/args_from_container.cpp 19 | :caption: args_from_container.cpp 20 | :name: args-from-container 21 | :linenos: 22 | 23 | It is basically implemented as a `one-way customization point`_. For more information about customization points, see the :doc:`tutorial on how to customize sol to work with your types<../tutorial/customization>`. 24 | 25 | .. _one-way customization point: https://github.com/ThePhD/sol2/blob/develop/sol/as_args.hpp 26 | -------------------------------------------------------------------------------- /documentation/source/api/as_returns.rst: -------------------------------------------------------------------------------- 1 | as_returns 2 | ========== 3 | *turn an iterable argument into a multiple-return type* 4 | 5 | 6 | .. code-block:: cpp 7 | 8 | template 9 | struct as_returns_t { ... }; 10 | 11 | template 12 | as_returns_t as_returns( T&& ); 13 | 14 | 15 | This allows you to wrap up a source that has ``begin`` and ``end`` iterator-returning functions on it and return it as multiple results into Lua. To have more control over the returns, use :doc:`sol::variadic_results`. 16 | 17 | 18 | .. literalinclude:: ../../../examples/source/as_returns.cpp 19 | :linenos: 20 | -------------------------------------------------------------------------------- /documentation/source/api/compatibility.rst: -------------------------------------------------------------------------------- 1 | compatibility.hpp 2 | ================= 3 | *Lua 5.3/5.2 compatibility for Lua 5.1/LuaJIT* 4 | 5 | 6 | This is a detail header used to maintain compatability with the 5.2 and 5.3+ APIs. It contains code from the MIT-Licensed `Lua code`_ in some places and also from the `lua-compat`_ repository by KeplerProject. 7 | 8 | It is not fully documented as this header's only purpose is for internal use to make sure sol compiles across all platforms / distributions with no errors or missing Lua functionality. If you think there's some compatibility features we are missing or if you are running into redefinition errors, please make an `issue in the issue tracker`_. 9 | 10 | If you have this already in your project or you have your own compatibility layer, then please ``#define SOL_NO_COMPAT 1`` before including ``sol.hpp`` or pass this flag on the command line to turn off the compatibility wrapper. 11 | 12 | For the licenses, see :doc:`here<../licenses>` 13 | 14 | .. _issue in the issue tracker: https://github.com/ThePhD/sol2/issues/ 15 | .. _Lua code: http://www.Lua.org/ 16 | .. _lua-compat: https://github.com/keplerproject/lua-compat-5.3 -------------------------------------------------------------------------------- /documentation/source/api/error.rst: -------------------------------------------------------------------------------- 1 | error 2 | ===== 3 | *the single error/exception type* 4 | 5 | 6 | .. code-block:: cpp 7 | 8 | class error : public std::runtime_error { 9 | public: 10 | error(const std::string& str): std::runtime_error("lua: error: " + str) {} 11 | }; 12 | 13 | 14 | .. note:: 15 | 16 | Please do not throw this error type yourself. It belongs to the library and we do some information appending at the front. 17 | 18 | 19 | If an eror is thrown by sol, it is going to be of this type. We use this in a single place: the default ``at_panic`` function we bind on construction of a :ref:`sol::state`. If you turn :doc:`off exceptions<../exceptions>`, the chances of you seeing this error are nil unless you specifically use it to pull errors out of things such as :doc:`sol::protected_function`. 20 | 21 | As it derives from ``std::runtime_error``, which derives from ``std::exception``, you can catch it with a ``catch (const std::exception& )`` clause in your try/catch blocks. You can retrieve a string error from Lua (Lua pushes all its errors as string returns) by using this type with any of the get or lookup functions in sol. 22 | -------------------------------------------------------------------------------- /documentation/source/api/lua_value.rst: -------------------------------------------------------------------------------- 1 | lua_value 2 | ========= 3 | *easy creation of Lua values and tables at the cost of some safety and speed* 4 | 5 | .. code-block:: cpp 6 | 7 | struct lua_value; 8 | struct array_value; 9 | 10 | 11 | The goal of these types is to make it easy to describe tables and arrays in C++ code. It works by using a thread local ``lua_State*`` variable inside the class so that one can simply pass values. The thread local variable is initialized by creation of a `sol::state`, but can also `be done manually` with ``sol::set_default_state``. An example of usage is below: 12 | 13 | .. literalinclude:: ../../../examples/source/lua_value.cpp 14 | :caption: lua_value.cpp 15 | :name: lua-value-example 16 | :linenos: 17 | -------------------------------------------------------------------------------- /documentation/source/api/metatable_key.rst: -------------------------------------------------------------------------------- 1 | metatable_key 2 | ============= 3 | *a key for setting and getting an object's metatable* 4 | 5 | 6 | .. code-block:: cpp 7 | 8 | struct metatable_key_t {}; 9 | const metatable_key_t metatable_key; 10 | 11 | You can use this in conjunction with :doc:`sol::table` to set/get a metatable. Lua metatables are powerful ways to override default behavior of objects for various kinds of operators, among other things. Here is an entirely complete example, showing getting and working with a :doc:`usertype`'s metatable defined by sol: 12 | 13 | .. literalinclude:: ../../../examples/source/metatable_key_low_level.cpp 14 | :caption: messing with metatables 15 | :name: sol-metatable_key-eg 16 | :linenos: 17 | -------------------------------------------------------------------------------- /documentation/source/api/optional.rst: -------------------------------------------------------------------------------- 1 | optional 2 | =========== 3 | 4 | This is an implemention of `optional from the standard library`_. If it detects that a proper optional exists, it will attempt to use it. This is mostly an implementation detail, used in the :ref:`sol::stack::check_get` and :ref:`sol::stack::get\>` and ``sol::optional maybe_value = table["arf"];`` implementations for additional safety reasons. 5 | 6 | See `this example here`_ for a demonstration on how to use it and other features! 7 | 8 | .. _optional from the standard library: http://en.cppreference.com/w/cpp/utility/optional 9 | .. _this example here: https://github.com/ThePhD/sol2/blob/develop/examples/source/optional_with_iteration.cpp 10 | -------------------------------------------------------------------------------- /documentation/source/api/property.rst: -------------------------------------------------------------------------------- 1 | property 2 | ======== 3 | *wrapper to specify read and write variable functionality using functions* 4 | 5 | .. code-block:: cpp 6 | 7 | template 8 | decltype(auto) property ( Read&& read_function, Write&& write_function ); 9 | template 10 | decltype(auto) property ( Read&& read_function ); 11 | template 12 | decltype(auto) property ( Write&& write_function ); 13 | 14 | These set of functions create a type which allows a setter and getter pair (or a single getter, or a single setter) to be used to create a variable that is either read-write, read-only, or write-only. When used during :doc:`usertype` construction, it will create a variable that uses the setter/getter member function specified. 15 | 16 | .. literalinclude:: ../../../examples/source/property.cpp 17 | :linenos: 18 | 19 | -------------------------------------------------------------------------------- /documentation/source/api/protect.rst: -------------------------------------------------------------------------------- 1 | protect 2 | ======= 3 | *routine to mark a function / variable as requiring safety* 4 | 5 | 6 | .. code-block:: cpp 7 | 8 | template 9 | auto protect( T&& value ); 10 | 11 | ``sol::protect( my_func )`` allows you to protect a function call or member variable call when it is being set to Lua. It can be used with usertypes or when just setting a function into sol. Below is an example that demonstrates that a call that would normally not error without :doc:`Safety features turned on<../safety>` that instead errors and makes the Lua safety-call wrapper ``pcall`` fail: 12 | 13 | .. literalinclude:: ../../../examples/source/protect.cpp 14 | :linenos: 15 | -------------------------------------------------------------------------------- /documentation/source/api/table_traversal_keys.rst: -------------------------------------------------------------------------------- 1 | table traversal keys 2 | ==================== 3 | *the definitive way to get and set things easily* 4 | 5 | 6 | Objects ``sol::update_if_empty``, ``sol::create_if_nil``, and ``sol::override_value`` are special keys one can pass into a table traversal to enable creating tables as they go in ``nil``/empty spaces, optionally updating a value at the end of a chain of lookups if it is empty, or overriding the values and tables along a chain as they go. Each special key can be used in lookup and setting functionality on tables. It is primarily to enable easy use and creation of functionality like so: 7 | 8 | .. literalinclude:: ../../../examples/source/table_create_if_nil.cpp 9 | :linenos: 10 | -------------------------------------------------------------------------------- /documentation/source/api/this_state.rst: -------------------------------------------------------------------------------- 1 | this_state 2 | ========== 3 | *transparent state argument for the current state* 4 | 5 | 6 | .. code-block:: cpp 7 | 8 | struct this_state; 9 | 10 | This class is a transparent type that is meant to be gotten in functions to get the current lua state a bound function or usertype method is being called from. It does not actually retrieve anything from lua nor does it increment the argument count, making it "invisible" to function calls in lua and calls through ``std::function<...>`` and :doc:`sol::function` on this type. It can be put in any position in the argument list of a function: 11 | 12 | .. literalinclude:: ../../../examples/source/this_state.cpp 13 | :linenos: 14 | -------------------------------------------------------------------------------- /documentation/source/api/tie.rst: -------------------------------------------------------------------------------- 1 | tie 2 | === 3 | *improved version of std::tie* 4 | 5 | 6 | `std::tie()`_ does not work well with :doc:`sol::function`'s ``sol::function_result`` returns. Use ``sol::tie`` instead. Because they're both named `tie`, you'll need to be explicit when you use sol's by naming it with the namespace (``sol::tie``), even with a ``using namespace sol;``. Here's an example: 7 | 8 | .. literalinclude:: ../../../examples/source/tie.cpp 9 | :linenos: 10 | 11 | .. _std::tie(): http://en.cppreference.com/w/cpp/utility/tuple/tie 12 | -------------------------------------------------------------------------------- /documentation/source/api/userdata.rst: -------------------------------------------------------------------------------- 1 | userdata 2 | ======== 3 | *reference to a userdata* 4 | 5 | .. code-block:: cpp 6 | :caption: (light\_)userdata reference 7 | 8 | class userdata : public table; 9 | 10 | class light_userdata : public table; 11 | 12 | These types are meant to hold a reference to a (light) userdata from Lua and make it easy to push an existing userdata onto the stack. It is essentially identical to :doc:`table
` in every way, just with a definitive C++ type that ensures the type is some form of userdata (helpful for trapping type errors with :doc:`safety features turned on<../safety>`). You can also use its ``.is()`` and ``.as()`` methods to check if its of a specific type and retrieve that type, respectively. 13 | -------------------------------------------------------------------------------- /documentation/source/api/var.rst: -------------------------------------------------------------------------------- 1 | var 2 | === 3 | *For hooking up static / global variables to Lua usertypes* 4 | 5 | 6 | The sole purpose of this tagging type is to work with :doc:`usertypes` to provide ``my_class.my_static_var`` access, and to also provide reference-based access as well. 7 | 8 | .. literalinclude:: ../../../examples/source/usertype_var.cpp 9 | :linenos: 10 | -------------------------------------------------------------------------------- /documentation/source/api/variadic_results.rst: -------------------------------------------------------------------------------- 1 | variadic_results 2 | ================ 3 | *push multiple disparate arguments into lua* 4 | 5 | .. code-block:: cpp 6 | 7 | struct variadic_results : std::vector { ... }; 8 | 9 | This type allows someone to prepare multiple returns before returning them into Lua. It derives from ``std::vector``, so it can be used exactly like that, and objects can be added using the various constructors and functions relating to :doc:`sol::object`. You can see it and other return-type helpers in action `here`_. 10 | 11 | .. _here: https://github.com/ThePhD/sol2/blob/develop/examples/source/multi_results.cpp 12 | -------------------------------------------------------------------------------- /documentation/source/api/yielding.rst: -------------------------------------------------------------------------------- 1 | yielding 2 | ======== 3 | *telling a C++ function to yield its results into Lua* 4 | 5 | .. code-block:: cpp 6 | 7 | template 8 | yield_wrapper yielding( F&& f ) 9 | 10 | ``sol::yielding`` is useful for calling C++ functions which need to yield into a Lua coroutine. It is a wrapper around a single argument which is expected to be bound as a function. You can pass it anywhere a regular function can be bound, **except for in usertype definitions**. 11 | -------------------------------------------------------------------------------- /documentation/source/build.rst: -------------------------------------------------------------------------------- 1 | build 2 | ===== 3 | 4 | sol2 is a header-only library. 5 | 6 | sol2 comes with a CMake script in the top level. It is primarily made for building and running the examples and tests, but it includes exported and configured targets (``sol2``, ``sol2_single``) for your use. ``sol2::sol2`` alias is defined for the ``sol2`` target as well. 7 | 8 | sol2 also comes with a Meson Script. If things stop working, file a bug report. 9 | 10 | 11 | -------------------------------------------------------------------------------- /documentation/source/media/Ko-fi_Blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/Ko-fi_Blue.png -------------------------------------------------------------------------------- /documentation/source/media/become_a_patron_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/become_a_patron_button.png -------------------------------------------------------------------------------- /documentation/source/media/bench/base_derived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/base_derived.png -------------------------------------------------------------------------------- /documentation/source/media/bench/c_function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/c_function.png -------------------------------------------------------------------------------- /documentation/source/media/bench/c_function_through_lua_in_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/c_function_through_lua_in_c.png -------------------------------------------------------------------------------- /documentation/source/media/bench/implicit_inheritance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/implicit_inheritance.png -------------------------------------------------------------------------------- /documentation/source/media/bench/lua_function_in_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/lua_function_in_c.png -------------------------------------------------------------------------------- /documentation/source/media/bench/member_function_call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/member_function_call.png -------------------------------------------------------------------------------- /documentation/source/media/bench/multi_return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/multi_return.png -------------------------------------------------------------------------------- /documentation/source/media/bench/multi_return_lua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/multi_return_lua.png -------------------------------------------------------------------------------- /documentation/source/media/bench/optional_failure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/optional_failure.png -------------------------------------------------------------------------------- /documentation/source/media/bench/optional_half_failure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/optional_half_failure.png -------------------------------------------------------------------------------- /documentation/source/media/bench/optional_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/optional_success.png -------------------------------------------------------------------------------- /documentation/source/media/bench/return_userdata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/return_userdata.png -------------------------------------------------------------------------------- /documentation/source/media/bench/stateful_function_object.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/stateful_function_object.png -------------------------------------------------------------------------------- /documentation/source/media/bench/table_chained_get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/table_chained_get.png -------------------------------------------------------------------------------- /documentation/source/media/bench/table_chained_set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/table_chained_set.png -------------------------------------------------------------------------------- /documentation/source/media/bench/table_get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/table_get.png -------------------------------------------------------------------------------- /documentation/source/media/bench/table_global_string_get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/table_global_string_get.png -------------------------------------------------------------------------------- /documentation/source/media/bench/table_global_string_set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/table_global_string_set.png -------------------------------------------------------------------------------- /documentation/source/media/bench/table_set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/table_set.png -------------------------------------------------------------------------------- /documentation/source/media/bench/userdata_variable_access.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/userdata_variable_access.png -------------------------------------------------------------------------------- /documentation/source/media/bench/userdata_variable_access_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/userdata_variable_access_large.png -------------------------------------------------------------------------------- /documentation/source/media/bench/userdata_variable_access_last.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/bench/userdata_variable_access_last.png -------------------------------------------------------------------------------- /documentation/source/media/discord_logo_wordmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/discord_logo_wordmark.png -------------------------------------------------------------------------------- /documentation/source/media/eevee_code_after.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/eevee_code_after.jpg -------------------------------------------------------------------------------- /documentation/source/media/eevee_code_before.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/eevee_code_before.jpg -------------------------------------------------------------------------------- /documentation/source/media/github_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/github_logo.png -------------------------------------------------------------------------------- /documentation/source/media/github_sponsors_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/github_sponsors_logo.png -------------------------------------------------------------------------------- /documentation/source/media/liberapay_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/liberapay_logo.png -------------------------------------------------------------------------------- /documentation/source/media/pp_cc_mark_111x69.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/pp_cc_mark_111x69.jpg -------------------------------------------------------------------------------- /documentation/source/media/sol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/sol.png -------------------------------------------------------------------------------- /documentation/source/media/sol.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePhD/sol2/c1f95a773c6f8f4fde8ca3efe872e7286afe4444/documentation/source/media/sol.psd -------------------------------------------------------------------------------- /documentation/source/rtti.rst: -------------------------------------------------------------------------------- 1 | run-time type information (rtti) 2 | ================================ 3 | *because somebody's going to want to shut this off, too...* 4 | 5 | sol does not use RTTI. 6 | 7 | .. _an issue: https://github.com/ThePhD/sol2/issues 8 | -------------------------------------------------------------------------------- /documentation/source/traits.rst: -------------------------------------------------------------------------------- 1 | customization traits 2 | ==================== 3 | 4 | These are customization points within the library to help you make sol2 work for the types in your framework and types. 5 | 6 | To learn more about various customizable traits, visit: 7 | 8 | * :doc:`containers customization traits` 9 | - This is how to work with containers in their entirety and what operations you're afforded on them 10 | - when you have an compiler error when serializing a type that has ``begin`` and ``end`` functions but isn't exactly a container 11 | * :doc:`unique usertype (custom pointer) traits` 12 | - This is how to deal with unique usertypes, e.g. ``boost::shared_ptr``, reference-counted pointers, etc 13 | - Useful for custom pointers from all sorts of frameworks or handle types that employ very specific kinds of destruction semantics and access 14 | * :doc:`customization points` 15 | - This is how to customize a type to work with sol2 16 | - Can be used for specializations to push strings and other class types that are not natively ``std::string`` or ``const char*``, like `a wxString, for example`_ 17 | 18 | .. _a wxString, for example: https://github.com/ThePhD/sol2/issues/140#issuecomment-237934947 19 | -------------------------------------------------------------------------------- /documentation/source/tutorial/tutorial-top.rst: -------------------------------------------------------------------------------- 1 | tutorial 2 | ======== 3 | 4 | Take some time to learn the framework with these tutorials. But, if you need to get going FAST, try using the :doc:`quick 'n' dirty` approach and your browser's / editors search function. It will also serve you well to look at all the `examples`_, which have recently gotten a bit of an overhaul to contain more relevant working examples and other advanced tricks that you can leverage to have a good time! 5 | 6 | 7 | .. toctree:: 8 | :caption: sol Tutorial 9 | :name: tutorialtoc 10 | :maxdepth: 2 11 | 12 | all-the-things 13 | getting-started 14 | existing 15 | variables 16 | functions 17 | cxx-in-lua 18 | ownership 19 | customization 20 | 21 | .. _examples: https://github.com/ThePhD/sol2/tree/develop/examples 22 | -------------------------------------------------------------------------------- /examples/customization/include/entity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef PROGRAM_ENTITY_HPP 4 | #define PROGRAM_ENTITY_HPP 5 | 6 | #include 7 | 8 | class entity { 9 | private: 10 | zm::vec3 position_; 11 | 12 | public: 13 | entity() { 14 | this->position_ = { 1, 1, 1 }; 15 | } 16 | 17 | zm::vec3 get_position() const { 18 | return this->position_; 19 | } 20 | void set_position(zm::vec3 v) { 21 | this->position_ = v; 22 | } 23 | }; 24 | 25 | #endif // PROGRAM_ENTITY_HPP 26 | -------------------------------------------------------------------------------- /examples/customization/include/lua_interop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef PROGRAM_LUA_INTEROP_HPP 4 | #define PROGRAM_LUA_INTEROP_HPP 5 | 6 | #include 7 | 8 | #define SOL_ALL_SAFETIES_ON 1 9 | #include 10 | 11 | void register_lua(sol::state& lua); 12 | 13 | #endif // PROGRAM_LUA_INTEROP_HPP 14 | -------------------------------------------------------------------------------- /examples/customization/include/lua_zm_interop.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef PROGRAM_LUA_ZM_INTEROP_HPP 4 | #define PROGRAM_LUA_ZM_INTEROP_HPP 5 | 6 | #define SOL_ALL_SAFETIES_ON 1 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | bool sol_lua_check(sol::types, lua_State* L, int index, 14 | std::function handler, 15 | sol::stack::record& tracking); 16 | 17 | zm::vec3 sol_lua_get(sol::types, lua_State* L, 18 | int index, sol::stack::record& tracking); 19 | 20 | int sol_lua_push( 21 | sol::types, lua_State* L, const zm::vec3& v); 22 | 23 | #endif // PROGRAM_LUA_ZM_INTEROP_HPP 24 | -------------------------------------------------------------------------------- /examples/customization/source/lua_interop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define SOL_ALL_SAFETIES_ON 1 6 | #include 7 | 8 | void register_lua(sol::state& lua) { 9 | lua.new_usertype("entity", 10 | "position", 11 | sol::property( 12 | &entity::get_position, &entity::set_position)); 13 | } 14 | -------------------------------------------------------------------------------- /examples/customization/source/lua_zm_interop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define SOL_ALL_SAFETIES_ON 1 6 | #include 7 | 8 | bool sol_lua_check(sol::types, lua_State* L, int index, 9 | std::function handler, 10 | sol::stack::record& tracking) { 11 | // use sol's method for checking 12 | // specifically for a table 13 | return sol::stack::check( 14 | L, index, handler, tracking); 15 | } 16 | 17 | zm::vec3 sol_lua_get(sol::types, lua_State* L, 18 | int index, sol::stack::record& tracking) { 19 | sol::lua_table vec3table 20 | = sol::stack::get(L, index, tracking); 21 | float x = vec3table["x"]; 22 | float y = vec3table["y"]; 23 | float z = vec3table["z"]; 24 | return zm::vec3 { x, y, z }; 25 | } 26 | 27 | int sol_lua_push( 28 | sol::types, lua_State* L, const zm::vec3& v) { 29 | // create table 30 | sol::state_view lua(L); 31 | sol::table vec3table = sol::table::create_with( 32 | L, "x", v.x, "y", v.y, "z", v.z); 33 | // use base sol method to 34 | // push the table 35 | int amount = sol::stack::push(L, vec3table); 36 | // return # of things pushed onto stack 37 | return amount; 38 | } 39 | -------------------------------------------------------------------------------- /examples/customization/source/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define SOL_ALL_SAFETIES_ON 1 5 | #include 6 | 7 | #include 8 | 9 | int main(int, char*[]) { 10 | std::cout << "=== customization: vec3 as table ===" 11 | << std::endl; 12 | 13 | sol::state lua; 14 | lua.open_libraries(sol::lib::base); 15 | 16 | std::cout << "registering entities into Lua ..." 17 | << std::endl; 18 | register_lua(lua); 19 | std::cout << "running script ..." << std::endl; 20 | 21 | const auto& script = R"lua( 22 | local e = entity.new() 23 | local pos = e.position 24 | print("pos type", type(pos)) 25 | print("pos", pos.x, pos.y, pos.z) 26 | e.position = { x = 52, y = 5.5, z = 47.5 } 27 | local new_pos = e.position 28 | print("pos", pos.x, pos.y, pos.z) 29 | print("new_pos", new_pos.x, new_pos.y, new_pos.z) 30 | )lua"; 31 | 32 | sol::optional result = lua.safe_script(script); 33 | if (result.has_value()) { 34 | std::cerr << "Something went horribly wrong: " 35 | << result.value().what() << std::endl; 36 | } 37 | 38 | std::cout << "finishing ..." << std::endl; 39 | 40 | std::cout << std::endl; 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /examples/interop/tolua/source/Player.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAYER_H 2 | #define PLAYER_H 3 | 4 | class Player { 5 | private: 6 | int m_health; 7 | 8 | public: 9 | Player() : m_health(0) { 10 | } 11 | void setHealth(int health) { 12 | m_health = health; 13 | } 14 | int getHealth() const { 15 | return m_health; 16 | } 17 | }; 18 | 19 | #endif // PLAYER_H 20 | -------------------------------------------------------------------------------- /examples/interop/tolua/source/Player.pkg: -------------------------------------------------------------------------------- 1 | $#include "Player.h" 2 | 3 | class Player { 4 | Player(); 5 | ~Player(); 6 | void setHealth(int _health); 7 | int getHealth(); 8 | }; 9 | -------------------------------------------------------------------------------- /examples/require_dll_example/include/my_object/my_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // forward declare as a C struct 6 | // so a pointer to lua_State can be part of a signature 7 | extern "C" { 8 | struct lua_State; 9 | } 10 | // you can replace the above if you're fine with including 11 | // earlier than absolutely necessary 12 | 13 | namespace my_object { 14 | 15 | struct test { 16 | int value; 17 | 18 | test() = default; 19 | test(int val) : value(val) { 20 | } 21 | }; 22 | 23 | } // namespace my_object 24 | 25 | // this function needs to be exported from your 26 | // dll. "extern 'C'" should do the trick, but 27 | // we're including platform-specific stuff here to help 28 | // see my_object_api.hpp for details 29 | extern "C" MY_OBJECT_API int luaopen_my_object(lua_State* L); 30 | -------------------------------------------------------------------------------- /examples/require_dll_example/include/my_object/my_object_api.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace my_object { 4 | 5 | #if defined _MSC_VER 6 | #define MY_OBJECT_VC 7 | #elif defined __GNUC__ 8 | #define MY_OBJECT_GCC 9 | #elif defined __clang__ 10 | #define MY_OBJECT_CLANG 11 | #endif 12 | 13 | #if defined MY_OBJECT_VC 14 | #if defined MY_OBJECT_DLL 15 | #if defined MY_OBJECT_BUILD 16 | #define MY_OBJECT_API __declspec(dllexport) 17 | #else 18 | #define MY_OBJECT_API __declspec(dllexport) 19 | #endif // MY_OBJECT_BUILD - Building the Library vs. Using the 20 | // Library 21 | #else 22 | #define MY_OBJECT_API 23 | #endif // Building a DLL vs. Static Library 24 | #else // g++ / clang++ 25 | #define MY_OBJECT_API __attribute__((visibility("default"))) 26 | #endif // MY_OBJECT_BUILD 27 | 28 | } // namespace my_object 29 | -------------------------------------------------------------------------------- /examples/require_dll_example/source/my_object.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define SOL_ALL_SAFETIES_ON 1 4 | #include 5 | 6 | namespace my_object { 7 | 8 | sol::table open_my_object(sol::this_state L) { 9 | sol::state_view lua(L); 10 | sol::table module = lua.create_table(); 11 | module.new_usertype("test", 12 | sol::constructors(), 13 | "value", 14 | &test::value); 15 | 16 | return module; 17 | } 18 | 19 | } // namespace my_object 20 | 21 | extern "C" int luaopen_my_object(lua_State* L) { 22 | // pass the lua_State, 23 | // the index to start grabbing arguments from, 24 | // and the function itself 25 | // optionally, you can pass extra arguments to the function 26 | // if that's necessary, but that's advanced usage and is 27 | // generally reserved for internals only 28 | return sol::stack::call_lua( 29 | L, 1, my_object::open_my_object); 30 | } 31 | -------------------------------------------------------------------------------- /examples/require_dll_example/source/require_from_dll.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | int main(int, char*[]) { 9 | std::cout << "=== require from DLL ===" << std::endl; 10 | 11 | sol::state lua; 12 | lua.open_libraries(sol::lib::package, sol::lib::base); 13 | 14 | const auto& code = R"( 15 | mo = require("my_object") 16 | 17 | obj = mo.test.new(24) 18 | print(obj.value))"; 19 | auto script_result 20 | = lua.safe_script(code, &sol::script_pass_on_error); 21 | if (script_result.valid()) { 22 | std::cout << "The DLL was require'd from successfully!" 23 | << std::endl; 24 | } 25 | else { 26 | sol::error err = script_result; 27 | std::cout << "Something bad happened: " << err.what() 28 | << std::endl; 29 | } 30 | SOL_ASSERT(script_result.valid()); 31 | my_object::test& obj = lua["obj"]; 32 | SOL_ASSERT(obj.value == 24); 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /examples/source/args_from_container.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int, const char*[]) { 9 | 10 | std::cout << "=== args_from_container ===" << std::endl; 11 | 12 | sol::state lua; 13 | lua.open_libraries(); 14 | 15 | lua.script("function f (a, b, c, d) print(a, b, c, d) end"); 16 | 17 | sol::function f = lua["f"]; 18 | 19 | std::vector v2 { 3, 4 }; 20 | f(1, 2, sol::as_args(v2)); 21 | 22 | std::set v4 { 3, 1, 2, 4 }; 23 | f(sol::as_args(v4)); 24 | 25 | int v3[] = { 2, 3, 4 }; 26 | f(1, sol::as_args(v3)); 27 | 28 | std::cout << std::endl; 29 | 30 | return 0; 31 | } -------------------------------------------------------------------------------- /examples/source/as_returns.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | #include 6 | #include 7 | 8 | int main() { 9 | sol::state lua; 10 | 11 | lua.set_function("f", []() { 12 | std::set results { 13 | "arf", "bark", "woof" 14 | }; 15 | return sol::as_returns(std::move(results)); 16 | }); 17 | 18 | lua.script("v1, v2, v3 = f()"); 19 | 20 | std::string v1 = lua["v1"]; 21 | std::string v2 = lua["v2"]; 22 | std::string v3 = lua["v3"]; 23 | 24 | SOL_ASSERT(v1 == "arf"); 25 | SOL_ASSERT(v2 == "bark"); 26 | SOL_ASSERT(v3 == "woof"); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/source/config.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | // shows how to load basic data to a struct 8 | 9 | struct config { 10 | std::string name; 11 | int width; 12 | int height; 13 | 14 | void print() { 15 | std::cout << "Name: " << name << '\n' 16 | << "Width: " << width << '\n' 17 | << "Height: " << height << '\n'; 18 | } 19 | }; 20 | 21 | int main() { 22 | sol::state lua; 23 | config screen; 24 | // To use the file, uncomment here and make sure it is in 25 | // local dir lua.script_file("config.lua"); 26 | lua.script(R"( 27 | name = "Asus" 28 | width = 1920 29 | height = 1080 30 | )"); 31 | screen.name = lua.get("name"); 32 | screen.width = lua.get("width"); 33 | screen.height = lua.get("height"); 34 | SOL_ASSERT(screen.name == "Asus"); 35 | SOL_ASSERT(screen.width == 1920); 36 | SOL_ASSERT(screen.height == 1080); 37 | 38 | std::cout << "=== config ===" << std::endl; 39 | screen.print(); 40 | std::cout << std::endl; 41 | } 42 | -------------------------------------------------------------------------------- /examples/source/config.lua: -------------------------------------------------------------------------------- 1 | name = "Asus" 2 | width = 1920 3 | height = 1080 4 | -------------------------------------------------------------------------------- /examples/source/container_with_pairs.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | #include 6 | #include 7 | 8 | int main() { 9 | struct hasher { 10 | typedef std::pair 11 | argument_type; 12 | typedef std::size_t result_type; 13 | 14 | result_type operator()(const argument_type& p) const { 15 | return std::hash()(p.first); 16 | } 17 | }; 18 | 19 | using my_set = std::unordered_set< 20 | std::pair, 21 | hasher>; 22 | 23 | std::cout << "=== containers with std::pair<> ===" 24 | << std::endl; 25 | 26 | sol::state lua; 27 | lua.open_libraries(sol::lib::base); 28 | 29 | lua.set_function("f", []() { 30 | return my_set { { "key1", "value1" }, 31 | { "key2", "value2" }, 32 | { "key3", "value3" } }; 33 | }); 34 | 35 | lua.safe_script("v = f()"); 36 | lua.safe_script("print('v:', v)"); 37 | lua.safe_script("print('#v:', #v)"); 38 | // note that using my_obj:pairs() is a 39 | // way around pairs(my_obj) not working in Lua 5.1/LuaJIT: 40 | // try it! 41 | lua.safe_script( 42 | "for k,v1,v2 in v:pairs() do print(k, v1, v2) end"); 43 | 44 | std::cout << std::endl; 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /examples/source/docs/as_function.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | int main() { 5 | struct callable { 6 | int operator()(int a, bool b) { 7 | return a + (b ? 10 : 20); 8 | } 9 | }; 10 | 11 | 12 | sol::state lua; 13 | // Binds struct as userdata 14 | // can still be callable, but beware 15 | // caveats 16 | lua.set("not_func", callable()); 17 | // Binds struct as function 18 | lua.set("func", sol::as_function(callable())); 19 | // equivalent: lua.set_function( "func", callable() ); 20 | // equivalent: lua["func"] = callable(); 21 | } 22 | -------------------------------------------------------------------------------- /examples/source/docs/as_function_usertype_member_variable.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | int main() { 5 | class B { 6 | public: 7 | int bvar = 24; 8 | }; 9 | 10 | sol::state lua; 11 | lua.open_libraries(sol::lib::base); 12 | lua.new_usertype("B", 13 | // bind as variable 14 | "b", 15 | &B::bvar, 16 | // bind as function 17 | "f", 18 | sol::as_function(&B::bvar)); 19 | 20 | B b; 21 | lua.set("b", &b); 22 | lua.script(R"(x = b:f() 23 | y = b.b 24 | assert(x == 24) 25 | assert(y == 24) 26 | )"); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/source/docs/as_table_ipairs.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main(int, char*[]) { 7 | 8 | sol::state lua; 9 | lua.open_libraries(); 10 | lua.set("my_table", 11 | sol::as_table(std::vector { 1, 2, 3, 4, 5 })); 12 | lua.script( 13 | "for k, v in ipairs(my_table) do print(k, v) assert(k " 14 | "== v) end"); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /examples/source/docs/coroutine_thread.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFTIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | const auto& co_lua_script = R"( 8 | function loop() 9 | while counter ~= 30 10 | do 11 | coroutine.yield(counter); 12 | counter = counter + 1; 13 | end 14 | return counter 15 | end 16 | )"; 17 | 18 | sol::state lua; 19 | lua.open_libraries(sol::lib::base, sol::lib::coroutine); 20 | /* 21 | lua.script_file("co.lua"); 22 | we load string directly rather than use a file 23 | */ 24 | lua.script(co_lua_script); 25 | sol::thread runner = sol::thread::create(lua.lua_state()); 26 | sol::state_view runnerstate = runner.state(); 27 | sol::coroutine loop_coroutine = runnerstate["loop"]; 28 | lua["counter"] = 20; 29 | 30 | for (int counter = 0; counter < 10 && loop_coroutine; 31 | ++counter) { 32 | // Call the coroutine, does the computation and then 33 | // suspends 34 | int value = loop_coroutine(); 35 | std::cout << "value is " << value << std::endl; 36 | } 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /examples/source/docs/inheritance.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | struct A { 5 | int a = 10; 6 | virtual int call() { 7 | return 0; 8 | } 9 | virtual ~A() { 10 | } 11 | }; 12 | struct B : A { 13 | int b = 11; 14 | virtual int call() override { 15 | return 20; 16 | } 17 | }; 18 | 19 | int main(int, char*[]) { 20 | 21 | sol::state lua; 22 | 23 | lua.new_usertype("A", "call", &A::call); 24 | 25 | lua.new_usertype("B", 26 | "call", 27 | &B::call, 28 | sol::base_classes, 29 | sol::bases()); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /examples/source/docs/my_panic.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | #include 4 | 5 | inline void my_panic(sol::optional maybe_msg) { 6 | std::cerr << "Lua is in a panic state and will now abort() " 7 | "the application" 8 | << std::endl; 9 | if (maybe_msg) { 10 | const std::string& msg = maybe_msg.value(); 11 | std::cerr << "\terror message: " << msg << std::endl; 12 | } 13 | // When this function exits, Lua will exhibit default 14 | // behavior and abort() 15 | } 16 | 17 | int main(int, char*[]) { 18 | sol::state lua(sol::c_call); 19 | // or, if you already have a lua_State* L 20 | // lua_atpanic( L, sol::c_call ); or, with state/state_view: sol::state_view 22 | // lua(L); lua.set_panic( sol::c_call ); 24 | 25 | // uncomment the below to see 26 | // lua.script("boom_goes.the_dynamite"); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/source/docs/preparing_environments.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | int main(int, char*[]) { 5 | sol::state lua; 6 | lua.open_libraries(); 7 | sol::environment my_env(lua, sol::create); 8 | // set value, and we need to explicitly allow for 9 | // access to "print", since a new environment hides 10 | // everything that's not defined inside of it 11 | // NOTE: hiding also hides library functions (!!) 12 | // BE WARNED 13 | my_env["var"] = 50; 14 | my_env["print"] = lua["print"]; 15 | 16 | sol::environment my_other_env( 17 | lua, sol::create, lua.globals()); 18 | // do not need to explicitly allow access to "print", 19 | // since we used the "Set a fallback" version 20 | // of the sol::environment constructor 21 | my_other_env["var"] = 443; 22 | 23 | // output: 50 24 | lua.script("print(var)", my_env); 25 | 26 | // output: 443 27 | lua.script("print(var)", my_other_env); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /examples/source/docs/references_in_lambdas.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | 7 | struct test { 8 | int blah = 0; 9 | }; 10 | 11 | test t; 12 | sol::state lua; 13 | lua.set_function("f", [&t]() { return t; }); 14 | lua.set_function("g", [&t]() -> test& { return t; }); 15 | 16 | lua.script("t1 = f()"); 17 | lua.script("t2 = g()"); 18 | 19 | test& from_lua_t1 = lua["t1"]; 20 | test& from_lua_t2 = lua["t2"]; 21 | 22 | // not the same: 'f' lambda copied 23 | SOL_ASSERT(&from_lua_t1 != &t); 24 | // the same: 'g' lambda returned reference 25 | SOL_ASSERT(&from_lua_t2 == &t); 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /examples/source/docs/runtime_extension.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | struct object { 7 | int value = 0; 8 | }; 9 | 10 | int main(int, char*[]) { 11 | 12 | std::cout << "==== runtime_extension =====" << std::endl; 13 | 14 | sol::state lua; 15 | lua.open_libraries(sol::lib::base); 16 | 17 | lua.new_usertype("object"); 18 | 19 | // runtime additions: through the sol API 20 | lua["object"]["func"] = [](object& o) { return o.value; }; 21 | // runtime additions: through a lua script 22 | lua.script( 23 | "function object:print () print(self:func()) end"); 24 | 25 | // see it work 26 | lua.script("local obj = object.new() \n obj:print()"); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/source/docs/simple_functions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | 3 | #include 4 | 5 | int main() { 6 | sol::state lua; 7 | int x = 0; 8 | lua.set_function("beep", [&x] { ++x; }); 9 | lua.script("beep()"); 10 | SOL_ASSERT(x == 1); 11 | 12 | sol::function beep = lua["beep"]; 13 | beep(); 14 | SOL_ASSERT(x == 2); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /examples/source/docs/simple_structs.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | 3 | #include 4 | 5 | struct vars { 6 | int boop = 0; 7 | 8 | int bop() const { 9 | return boop + 1; 10 | } 11 | }; 12 | 13 | int main() { 14 | sol::state lua; 15 | lua.new_usertype( 16 | "vars", "boop", &vars::boop, "bop", &vars::bop); 17 | lua.script( 18 | "beep = vars.new()\n" 19 | "beep.boop = 1\n" 20 | "bopvalue = beep:bop()"); 21 | 22 | vars& beep = lua["beep"]; 23 | int bopvalue = lua["bopvalue"]; 24 | 25 | SOL_ASSERT(beep.boop == 1); 26 | SOL_ASSERT(lua.get("beep").boop == 1); 27 | SOL_ASSERT(beep.bop() == 2); 28 | SOL_ASSERT(bopvalue == 2); 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /examples/source/docs/state_transfer.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | 3 | #include 4 | 5 | #include 6 | 7 | int main(int, char*[]) { 8 | 9 | sol::state lua; 10 | lua.open_libraries(); 11 | sol::function transferred_into; 12 | lua["f"] = [&lua, &transferred_into]( 13 | sol::object t, sol::this_state this_L) { 14 | std::cout << "state of main : " 15 | << (void*)lua.lua_state() << std::endl; 16 | std::cout << "state of function : " 17 | << (void*)this_L.lua_state() << std::endl; 18 | // pass original lua_State* (or 19 | // sol::state/sol::state_view) transfers ownership from 20 | // the state of "t", to the "lua" sol::state 21 | transferred_into = sol::function(lua, t); 22 | }; 23 | 24 | lua.script(R"( 25 | i = 0 26 | function test() 27 | co = coroutine.create( 28 | function() 29 | local g = function() i = i + 1 end 30 | f(g) 31 | g = nil 32 | collectgarbage() 33 | end 34 | ) 35 | coroutine.resume(co) 36 | co = nil 37 | collectgarbage() 38 | end 39 | )"); 40 | 41 | // give it a try 42 | lua.safe_script("test()"); 43 | // should call 'g' from main thread, increment i by 1 44 | transferred_into(); 45 | // check 46 | int i = lua["i"]; 47 | SOL_ASSERT(i == 1); 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /examples/source/environment_state.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main(int, char*[]) { 7 | std::cout << "=== environment state ===" << std::endl; 8 | 9 | sol::state lua; 10 | lua.open_libraries(); 11 | sol::environment my_env(lua, sol::create); 12 | // set value, and we need to explicitly allow for 13 | // access to "print", since a new environment hides 14 | // everything that's not defined inside of it 15 | // NOTE: hiding also hides library functions (!!) 16 | // BE WARNED 17 | my_env["var"] = 50; 18 | my_env["print"] = lua["print"]; 19 | 20 | sol::environment my_other_env( 21 | lua, sol::create, lua.globals()); 22 | // do not need to explicitly allow access to "print", 23 | // since we used the "Set a fallback" version 24 | // of the sol::environment constructor 25 | my_other_env["var"] = 443; 26 | 27 | // output: 50 28 | lua.script("print(var)", my_env); 29 | 30 | // output: 443 31 | lua.script("print(var)", my_other_env); 32 | 33 | 34 | std::cout << std::endl; 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /examples/source/environment_state_2.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main(int, char*[]) { 7 | std::cout << "=== environment state 2 ===" << std::endl; 8 | 9 | sol::state lua; 10 | lua.open_libraries(); 11 | 12 | sol::environment env(lua, sol::create, lua.globals()); 13 | env["func"] = []() { return 42; }; 14 | 15 | sol::environment env2(lua, sol::create, lua.globals()); 16 | env2["func"] = []() { return 24; }; 17 | 18 | lua.script("function foo() print(func()) end", env); 19 | lua.script("function foo() print(func()) end", env2); 20 | 21 | env["foo"](); // prints 42 22 | env2["foo"](); // prints 24 23 | 24 | std::cout << std::endl; 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /examples/source/index_and_newindex_usertype.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | class vector { 6 | public: 7 | double data[3]; 8 | 9 | vector() : data { 0, 0, 0 } { 10 | } 11 | 12 | double& operator[](int i) { 13 | return data[i]; 14 | } 15 | 16 | 17 | static double my_index(vector& v, int i) { 18 | return v[i]; 19 | } 20 | 21 | static void my_new_index(vector& v, int i, double x) { 22 | v[i] = x; 23 | } 24 | }; 25 | 26 | int main() { 27 | sol::state lua; 28 | lua.open_libraries(sol::lib::base); 29 | lua.new_usertype("vector", 30 | sol::constructors>(), 31 | sol::meta_function::index, 32 | &vector::my_index, 33 | sol::meta_function::new_index, 34 | &vector::my_new_index); 35 | lua.script( 36 | "v = vector.new()\n" 37 | "print(v[1])\n" 38 | "v[2] = 3\n" 39 | "print(v[2])\n"); 40 | 41 | vector& v = lua["v"]; 42 | SOL_ASSERT(v[0] == 0.0); 43 | SOL_ASSERT(v[1] == 0.0); 44 | SOL_ASSERT(v[2] == 3.0); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /examples/source/lua_stream.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_CHECK_ARGUMENTS 1 2 | #include 3 | 4 | #include 5 | 6 | bool is_file_std_out(sol::table data) { 7 | sol::object maybe_file = data["file"]; 8 | if (maybe_file.is()) { 9 | luaL_Stream& filestream = data["file"]; 10 | return filestream.f == stdout; 11 | } 12 | return false; 13 | } 14 | 15 | int main() { 16 | sol::state lua; 17 | lua.open_libraries(sol::lib::base, sol::lib::io); 18 | 19 | lua["is_std_out"] = &is_file_std_out; 20 | lua.script("assert(is_std_out{ file = io.stdout })"); 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /examples/source/metatable_key_low_level.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | 7 | struct bark { 8 | int operator()(int x) { 9 | return x; 10 | } 11 | }; 12 | 13 | sol::state lua; 14 | lua.open_libraries(sol::lib::base); 15 | 16 | lua.new_usertype("bark", 17 | sol::meta_function::call_function, 18 | &bark::operator()); 19 | 20 | bark b; 21 | lua.set("b", &b); 22 | 23 | sol::table b_as_table = lua["b"]; 24 | sol::table b_metatable = b_as_table[sol::metatable_key]; 25 | sol::function b_call = b_metatable["__call"]; 26 | sol::function b_as_function = lua["b"]; 27 | 28 | int result1 = b_as_function(1); 29 | // pass 'self' directly to argument 30 | int result2 = b_call(b, 1); 31 | SOL_ASSERT(result1 == result2); 32 | SOL_ASSERT(result1 == 1); 33 | SOL_ASSERT(result2 == 1); 34 | } 35 | -------------------------------------------------------------------------------- /examples/source/overloading.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | inline int my_add(int x, int y) { 7 | return x + y; 8 | } 9 | 10 | inline std::string make_string(std::string input) { 11 | return "string: " + input; 12 | } 13 | 14 | int main() { 15 | std::cout << "=== overloading ===" << std::endl; 16 | 17 | sol::state lua; 18 | lua.open_libraries(sol::lib::base); 19 | 20 | // you can overload functions 21 | // just pass in the different functions 22 | // you want to pack into a single name: 23 | // make SURE they take different types! 24 | 25 | lua.set_function("func", sol::overload([](int x) { return x; }, make_string, my_add)); 26 | 27 | // All these functions are now overloaded through "func" 28 | lua.script(R"( 29 | print(func(1)) 30 | print(func("bark")) 31 | print(func(1,2)) 32 | )"); 33 | 34 | std::cout << std::endl; 35 | 36 | return 0; 37 | } -------------------------------------------------------------------------------- /examples/source/overloading_with_fallback.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int func_1(int value) { 7 | return 20 + value; 8 | } 9 | 10 | std::string func_2(std::string text) { 11 | return "received: " + text; 12 | } 13 | 14 | sol::variadic_results fallback( 15 | sol::this_state ts, sol::variadic_args args) { 16 | sol::variadic_results r; 17 | if (args.size() == 2) { 18 | r.push_back({ ts, 19 | sol::in_place, 20 | args.get(0) + args.get(1) }); 21 | } 22 | else { 23 | r.push_back({ ts, sol::in_place, 52 }); 24 | } 25 | return r; 26 | } 27 | 28 | int main(int, char*[]) { 29 | std::cout << "=== overloading with fallback ===" 30 | << std::endl; 31 | 32 | sol::state lua; 33 | lua.open_libraries(); 34 | 35 | lua.set_function( 36 | "f", sol::overload(func_1, func_2, fallback)); 37 | 38 | lua.script("print(f(1))"); // func_1 39 | lua.script("print(f('hi'))"); // func_2 40 | lua.script("print(f(22, 11))"); // fallback 41 | lua.script("print(f({}))"); // fallback 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /examples/source/overridable_function_members.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | std::cout << "=== override-able member functions ===" 8 | << std::endl; 9 | 10 | struct thingy { 11 | sol::function paint; 12 | 13 | thingy(sol::this_state L) 14 | : paint(sol::make_reference( 15 | L.lua_state(), &thingy::default_paint)) { 16 | } 17 | 18 | void default_paint() { 19 | std::cout << "p" << std::endl; 20 | } 21 | }; 22 | 23 | sol::state lua; 24 | lua.open_libraries(sol::lib::base); 25 | 26 | lua.new_usertype("thingy", 27 | sol::constructors(), 28 | "paint", 29 | &thingy::paint); 30 | 31 | sol::string_view code = R"( 32 | obj = thingy.new() 33 | obj:paint() 34 | obj.paint = function (self) print("g") end 35 | obj:paint() 36 | function obj:paint () print("s") end 37 | obj:paint() 38 | )"; 39 | 40 | lua.safe_script(code); 41 | 42 | std::cout << std::endl; 43 | 44 | return 0; 45 | } -------------------------------------------------------------------------------- /examples/source/player_script.lua: -------------------------------------------------------------------------------- 1 | -- call single argument integer constructor 2 | p1 = player.new(2) 3 | 4 | -- p2 is still here from being 5 | -- set with lua["p2"] = player(0); below 6 | local p2shoots = p2:shoot() 7 | assert(not p2shoots) 8 | -- had 0 ammo 9 | 10 | -- set variable property setter 11 | p1.hp = 545; 12 | -- get variable through property getter 13 | print(p1.hp); 14 | 15 | local did_shoot_1 = p1:shoot() 16 | print(did_shoot_1) 17 | print(p1.bullets) 18 | local did_shoot_2 = p1:shoot() 19 | print(did_shoot_2) 20 | print(p1.bullets) 21 | local did_shoot_3 = p1:shoot() 22 | print(did_shoot_3) 23 | 24 | -- can read 25 | print(p1.bullets) 26 | -- would error: is a readonly variable, cannot write 27 | -- p1.bullets = 20 28 | 29 | p1:boost() 30 | -------------------------------------------------------------------------------- /examples/source/protect.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | 7 | struct protect_me { 8 | int gen(int x) { 9 | return x; 10 | } 11 | }; 12 | 13 | sol::state lua; 14 | lua.open_libraries(sol::lib::base); 15 | lua.new_usertype( 16 | "protect_me", "gen", sol::protect(&protect_me::gen)); 17 | 18 | lua.script(R"__( 19 | pm = protect_me.new() 20 | value = pcall(pm.gen,"wrong argument") 21 | )__"); 22 | bool value = lua["value"]; 23 | SOL_ASSERT(!value); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /examples/source/protected_functions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | std::cout << "=== protected_functions ===" << std::endl; 8 | 9 | sol::state lua; 10 | lua.open_libraries(sol::lib::base); 11 | 12 | // A complicated function which can error out 13 | // We define both in terms of Lua code 14 | 15 | lua.script(R"( 16 | function handler (message) 17 | return "Handled this message: " .. message 18 | end 19 | 20 | function f (a) 21 | if a < 0 then 22 | error("negative number detected") 23 | end 24 | return a + 5 25 | end 26 | )"); 27 | 28 | // Get a protected function out of Lua 29 | sol::protected_function f(lua["f"], lua["handler"]); 30 | 31 | sol::protected_function_result result = f(-500); 32 | if (result.valid()) { 33 | // Call succeeded 34 | int x = result; 35 | std::cout << "call succeeded, result is " << x 36 | << std::endl; 37 | } 38 | else { 39 | // Call failed 40 | sol::error err = result; 41 | std::string what = err.what(); 42 | std::cout << "call failed, sol::error::what() is " 43 | << what << std::endl; 44 | // 'what' Should read 45 | // "Handled this message: negative number detected" 46 | } 47 | 48 | std::cout << std::endl; 49 | } 50 | -------------------------------------------------------------------------------- /examples/source/runtime_additions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | struct object { 7 | int value = 0; 8 | }; 9 | 10 | int main(int, char*[]) { 11 | std::cout << "=== runtime_additions ===" << std::endl; 12 | 13 | sol::state lua; 14 | lua.open_libraries(sol::lib::base); 15 | 16 | lua.new_usertype("object"); 17 | 18 | // runtime additions: through the sol API 19 | lua["object"]["func"] = [](object& o) { 20 | ++o.value; 21 | return o.value; 22 | }; 23 | // runtime additions: through a lua script 24 | lua.script(R"( 25 | function object:print () 26 | print(self:func()) 27 | end 28 | )"); 29 | 30 | // see it work 31 | lua.script(R"( 32 | obj = object.new() 33 | obj:print() 34 | )"); 35 | 36 | object& obj = lua["obj"]; 37 | SOL_ASSERT(obj.value == 1); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /examples/source/stack_aligned_function.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | lua.script("function func (a, b) return (a + b) * 2 end"); 8 | 9 | sol::reference func_ref = lua["func"]; 10 | 11 | // for some reason, you need to use the low-level API 12 | func_ref.push(); // function on stack now 13 | 14 | // maybe this is in a lua_CFunction you bind, 15 | // or maybe you're trying to work with a pre-existing system 16 | // maybe you've used a custom lua_load call, or you're 17 | // working with state_view's load(lua_Reader, ...) call... 18 | // here's a little bit of how you can work with the stack 19 | lua_State* L = lua.lua_state(); 20 | sol::stack_aligned_unsafe_function func(L, -1); 21 | lua_pushinteger(L, 5); // argument 1, using plain API 22 | lua_pushinteger(L, 6); // argument 2 23 | 24 | // take 2 arguments from the top, 25 | // and use "stack_aligned_function" to call 26 | int result = func(sol::stack_count(2)); 27 | 28 | // make sure everything is clean 29 | SOL_ASSERT(result == 22); 30 | SOL_ASSERT( 31 | lua.stack_top() == 0); // stack is empty/balanced 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /examples/source/table_as_container.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | struct Vector { 6 | int x; 7 | int y; 8 | 9 | Vector() = default; 10 | 11 | Vector(int _x, int _y) : x { _x }, y { _y } { 12 | } 13 | }; 14 | 15 | int main() { 16 | sol::state lua; 17 | lua.open_libraries(sol::lib::base); 18 | 19 | lua.new_usertype("Vector", 20 | sol::constructors(), 21 | "x", 22 | sol::property(&Vector::x, &Vector::x), 23 | "y", 24 | sol::property(&Vector::y, &Vector::y)); 25 | 26 | lua.script( 27 | "vectors = { Vector.new(3, 6), Vector.new(6, 3) }"); 28 | auto vectors = lua["vectors"].get>(); 29 | 30 | SOL_ASSERT(vectors[0].x == 3); 31 | SOL_ASSERT(vectors[0].y == 6); 32 | 33 | SOL_ASSERT(vectors[1].x == 6); 34 | SOL_ASSERT(vectors[1].y == 3); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /examples/source/table_create_if_nil.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | void create_namespace_sf(sol::state& lua) { 7 | // this would explode 8 | // lua["sf"]["value"] = 256; 9 | lua[sol::create_if_nil]["sf"]["value"] = 256; 10 | } 11 | 12 | int main(int, char*[]) { 13 | 14 | std::cout << "=== sol::lua_value/sol::array_value ===" 15 | << std::endl; 16 | 17 | sol::state lua; 18 | lua.open_libraries(sol::lib::base); 19 | 20 | const auto& code = R"( 21 | print(sf) 22 | print(sf.value) 23 | assert(sf.value == 256) 24 | )"; 25 | 26 | auto result 27 | = lua.safe_script(code, sol::script_pass_on_error); 28 | // did not work 29 | SOL_ASSERT(!result.valid()); 30 | 31 | // create values 32 | create_namespace_sf(lua); 33 | 34 | auto result2 35 | = lua.safe_script(code, sol::script_pass_on_error); 36 | // it worked properly 37 | SOL_ASSERT(result2.valid()); 38 | 39 | std::cout << std::endl; 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /examples/source/table_proxy.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main() { 6 | 7 | const auto& code = R"( 8 | bark = { 9 | woof = { 10 | [2] = "arf!" 11 | } 12 | } 13 | )"; 14 | 15 | sol::state lua; 16 | lua.open_libraries(sol::lib::base); 17 | lua.script(code); 18 | 19 | // produces table_proxy, implicitly converts to std::string, 20 | // quietly destroys table_proxy 21 | std::string arf_string = lua["bark"]["woof"][2]; 22 | 23 | // lazy-evaluation of tables 24 | auto x = lua["bark"]; 25 | auto y = x["woof"]; 26 | auto z = y[2]; 27 | 28 | // retrivies value inside of lua table above 29 | std::string value = z; 30 | SOL_ASSERT(value == "arf!"); 31 | 32 | // Can change the value later... 33 | z = 20; 34 | 35 | // Yay, lazy-evaluation! 36 | int changed_value = z; // now it's 20! 37 | SOL_ASSERT(changed_value == 20); 38 | lua.script("assert(bark.woof[2] == 20)"); 39 | 40 | lua["a_new_value"] = 24; 41 | lua["chase_tail"] = [](int chasing) { 42 | int r = 2; 43 | for (int i = 0; i < chasing; ++i) { 44 | r *= r; 45 | } 46 | return r; 47 | }; 48 | 49 | lua.script("assert(a_new_value == 24)"); 50 | lua.script("assert(chase_tail(2) == 16)"); 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /examples/source/this_state.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main() { 6 | sol::state lua; 7 | 8 | lua.set_function( 9 | "bark", [](sol::this_state s, int a, int b) { 10 | lua_State* L = s; // current state 11 | return a + b + lua_gettop(L); 12 | }); 13 | 14 | lua.script( 15 | "first = bark(2, 2)"); // only takes 2 arguments, NOT 3 16 | 17 | // Can be at the end, too, or in the middle: doesn't matter 18 | lua.set_function( 19 | "bark", [](int a, int b, sol::this_state s) { 20 | lua_State* L = s; // current state 21 | return a + b + lua_gettop(L); 22 | }); 23 | 24 | lua.script("second = bark(2, 2)"); // only takes 2 arguments 25 | int first = lua["first"]; 26 | SOL_ASSERT(first == 6); 27 | int second = lua["second"]; 28 | SOL_ASSERT(second == 6); 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /examples/source/tie.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | 7 | const auto& code = R"( 8 | bark_power = 11; 9 | 10 | function woof ( bark_energy ) 11 | return (bark_energy * (bark_power / 4)) 12 | end 13 | )"; 14 | 15 | sol::state lua; 16 | 17 | lua.script(code); 18 | 19 | sol::function woof = lua["woof"]; 20 | double numwoof = woof(20); 21 | SOL_ASSERT(numwoof == 55.0); 22 | 23 | lua.script("function f () return 10, 11, 12 end"); 24 | 25 | sol::function f = lua["f"]; 26 | std::tuple abc = f(); 27 | SOL_ASSERT(std::get<0>(abc) == 10); 28 | SOL_ASSERT(std::get<1>(abc) == 11); 29 | SOL_ASSERT(std::get<2>(abc) == 12); 30 | // or 31 | int a, b, c; 32 | sol::tie(a, b, c) = f(); 33 | SOL_ASSERT(a == 10); 34 | SOL_ASSERT(b == 11); 35 | SOL_ASSERT(c == 12); 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /examples/source/tutorials/erase_demo.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | 8 | sol::state lua; 9 | lua["bark"] = 50; 10 | sol::optional x = lua["bark"]; 11 | // x will have a value 12 | if (x) { 13 | std::cout << "x has no value, as expected" 14 | << std::endl; 15 | } 16 | else { 17 | return -1; 18 | } 19 | 20 | lua["bark"] = sol::lua_nil; 21 | sol::optional y = lua["bark"]; 22 | // y will not have a value 23 | if (y) { 24 | return -1; 25 | } 26 | else { 27 | std::cout << "y has no value, as expected" 28 | << std::endl; 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /examples/source/tutorials/first_snippet.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include // or #include "sol.hpp", whichever suits your needs 3 | 4 | int main(int argc, char* argv[]) { 5 | // silence unused warnings 6 | (void)argc; 7 | (void)argv; 8 | 9 | sol::state lua; 10 | lua.open_libraries(sol::lib::base); 11 | 12 | lua.script("print('bark bark bark!')"); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /examples/source/tutorials/lazy_demo.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | 8 | sol::state lua; 9 | 10 | auto barkkey = lua["bark"]; 11 | if (barkkey.valid()) { 12 | // Branch not taken: doesn't exist yet 13 | std::cout << "How did you get in here, arf?!" 14 | << std::endl; 15 | } 16 | 17 | barkkey = 50; 18 | if (barkkey.valid()) { 19 | // Branch taken: value exists! 20 | std::cout << "Bark Bjork Wan Wan Wan" << std::endl; 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /examples/source/tutorials/multiple_return.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | int main() { 5 | sol::state lua; 6 | 7 | lua.script("function f (a, b, c) return a, b, c end"); 8 | 9 | std::tuple result; 10 | result = lua["f"](1, 2, 3); 11 | SOL_ASSERT(result == std::make_tuple(1, 2, 3)); 12 | int a, b; 13 | std::string c; 14 | // NOTE: sol::tie, NOT std::tie 15 | // (ESS OH ELL prefix, not ESS TEE DEE prefix) 16 | sol::tie(a, b, c) = lua["f"](1, 2, "bark"); 17 | SOL_ASSERT(a == 1); 18 | SOL_ASSERT(b == 2); 19 | SOL_ASSERT(c == "bark"); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /examples/source/tutorials/object_lifetime.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int main() { 8 | sol::state lua; 9 | lua.open_libraries(sol::lib::base); 10 | 11 | lua.script(R"( 12 | obj = "please don't let me die"; 13 | )"); 14 | 15 | sol::object keep_alive = lua["obj"]; 16 | lua.script(R"( 17 | obj = nil; 18 | function say(msg) 19 | print(msg) 20 | end 21 | )"); 22 | 23 | lua.collect_garbage(); 24 | 25 | lua["say"](lua["obj"]); 26 | // still accessible here and still alive in Lua 27 | // even though the name was cleared 28 | std::string message = keep_alive.as(); 29 | std::cout << message << std::endl; 30 | 31 | // Can be pushed back into Lua as an argument 32 | // or set to a new name, 33 | // whatever you like! 34 | lua["say"](keep_alive); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /examples/source/tutorials/open_multiple_libraries.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | int main(int argc, char* argv[]) { 5 | // silence unused warnings 6 | (void)argc; 7 | (void)argv; 8 | sol::state lua; 9 | lua.open_libraries(sol::lib::base, 10 | sol::lib::coroutine, 11 | sol::lib::string, 12 | sol::lib::io); 13 | 14 | lua.script("print('bark bark bark!')"); 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/arguments_to_scripts.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main(int, char*[]) { 7 | std::cout << "=== passing arguments to scripts ===" 8 | << std::endl; 9 | 10 | sol::state lua; 11 | lua.open_libraries(sol::lib::base); 12 | 13 | const auto& my_script = R"( 14 | local a,b,c = ... 15 | print(a,b,c) 16 | )"; 17 | 18 | sol::load_result fx = lua.load(my_script); 19 | if (!fx.valid()) { 20 | sol::error err = fx; 21 | std::cerr << "failed to load string-based script into " 22 | "the program" 23 | << err.what() << std::endl; 24 | } 25 | 26 | // prints "your arguments here" 27 | fx("your", "arguments", "here"); 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/functions_easy.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | lua.open_libraries(sol::lib::base); 8 | 9 | lua.script("function f (a, b, c, d) return 1 end"); 10 | lua.script("function g (a, b) return a + b end"); 11 | 12 | // sol::function is often easier: 13 | // takes a variable number/types of arguments... 14 | sol::function fx = lua["f"]; 15 | // fixed signature std::function<...> 16 | // can be used to tie a sol::function down 17 | std::function stdfx 18 | = fx; 19 | 20 | int is_one = stdfx(1, 34.5, 3, "bark"); 21 | SOL_ASSERT(is_one == 1); 22 | int is_also_one = fx(1, "boop", 3, "bark"); 23 | SOL_ASSERT(is_also_one == 1); 24 | 25 | // call through operator[] 26 | int is_three = lua["g"](1, 2); 27 | SOL_ASSERT(is_three == 3); 28 | double is_4_8 = lua["g"](2.4, 2.4); 29 | SOL_ASSERT(is_4_8 == 4.8); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/make_tables.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | lua.open_libraries(sol::lib::base); 8 | 9 | lua["abc_sol2"] = lua.create_table_with(0, 24); 10 | 11 | sol::table inner_table = lua.create_table_with("bark", 12 | 50, 13 | // can reference other existing stuff too 14 | "woof", 15 | lua["abc_sol2"]); 16 | lua.create_named_table("def_sol2", "ghi", inner_table); 17 | 18 | std::string code = R"( 19 | abc = { [0] = 24 } 20 | def = { 21 | ghi = { 22 | bark = 50, 23 | woof = abc 24 | } 25 | } 26 | )"; 27 | 28 | lua.script(code); 29 | lua.script(R"( 30 | assert(abc_sol2[0] == abc[0]) 31 | assert(def_sol2.ghi.bark == def.ghi.bark) 32 | )"); 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/multiple_returns_from_lua.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | 8 | lua.script("function f (a, b, c) return a, b, c end"); 9 | 10 | std::tuple result; 11 | result = lua["f"](100, 200, 300); 12 | // result == { 100, 200, 300 } 13 | int a; 14 | int b; 15 | std::string c; 16 | sol::tie(a, b, c) = lua["f"](100, 200, "bark"); 17 | SOL_ASSERT(a == 100); 18 | SOL_ASSERT(b == 200); 19 | SOL_ASSERT(c == "bark"); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/multiple_returns_to_lua.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | lua.open_libraries(sol::lib::base); 8 | 9 | lua["f"] = [](int a, int b, sol::object c) { 10 | // sol::object can be anything here: just pass it 11 | // through 12 | return std::make_tuple(a, b, c); 13 | }; 14 | 15 | std::tuple result = lua["f"](100, 200, 300); 16 | const std::tuple expected(100, 200, 300); 17 | SOL_ASSERT(result == expected); 18 | 19 | std::tuple result2; 20 | result2 = lua["f"](100, 200, "BARK BARK BARK!"); 21 | const std::tuple expected2( 22 | 100, 200, "BARK BARK BARK!"); 23 | SOL_ASSERT(result2 == expected2); 24 | 25 | int a, b; 26 | std::string c; 27 | sol::tie(a, b, c) = lua["f"](100, 200, "bark"); 28 | SOL_ASSERT(a == 100); 29 | SOL_ASSERT(b == 200); 30 | SOL_ASSERT(c == "bark"); 31 | 32 | lua.script(R"( 33 | a, b, c = f(150, 250, "woofbark") 34 | assert(a == 150) 35 | assert(b == 250) 36 | assert(c == "woofbark") 37 | )"); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/opening_a_state.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main(int, char*[]) { 7 | std::cout << "=== opening a state ===" << std::endl; 8 | 9 | sol::state lua; 10 | // open some common libraries 11 | lua.open_libraries(sol::lib::base, sol::lib::package); 12 | lua.script("print('bark bark bark!')"); 13 | 14 | std::cout << std::endl; 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/opening_state_on_raw_lua.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int use_sol2(lua_State* L) { 7 | sol::state_view lua(L); 8 | lua.script("print('bark bark bark!')"); 9 | return 0; 10 | } 11 | 12 | int main(int, char*[]) { 13 | std::cout << "=== opening sol::state_view on raw Lua ===" 14 | << std::endl; 15 | 16 | lua_State* L = luaL_newstate(); 17 | luaL_openlibs(L); 18 | 19 | lua_pushcclosure(L, &use_sol2, 0); 20 | lua_setglobal(L, "use_sol2"); 21 | 22 | if (luaL_dostring(L, "use_sol2()")) { 23 | lua_error(L); 24 | return -1; 25 | } 26 | 27 | std::cout << std::endl; 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/running_lua_code_low_level.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int, char*[]) { 9 | std::cout << "=== running lua code (low level) ===" 10 | << std::endl; 11 | 12 | { 13 | std::ofstream out("a_lua_script.lua"); 14 | out << "print('hi from a lua script file')"; 15 | } 16 | 17 | sol::state lua; 18 | lua.open_libraries(sol::lib::base); 19 | 20 | // load file without execute 21 | sol::load_result script1 22 | = lua.load_file("a_lua_script.lua"); 23 | // execute 24 | script1(); 25 | 26 | // load string without execute 27 | sol::load_result script2 = lua.load("a = 'test'"); 28 | // execute 29 | sol::protected_function_result script2result = script2(); 30 | // optionally, check if it worked 31 | if (script2result.valid()) { 32 | // yay! 33 | } 34 | else { 35 | // aww 36 | } 37 | 38 | sol::load_result script3 = lua.load("return 24"); 39 | // execute, get return value 40 | int value2 = script3(); 41 | SOL_ASSERT(value2 == 24); 42 | 43 | std::cout << std::endl; 44 | 45 | { std::remove("a_lua_script.lua"); } 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/self_call.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | std::cout << "=== self_call ===" << std::endl; 8 | 9 | sol::state lua; 10 | lua.open_libraries( 11 | sol::lib::base, sol::lib::package, sol::lib::table); 12 | 13 | // a small script using 'self' syntax 14 | lua.script(R"( 15 | some_table = { some_val = 100 } 16 | 17 | function some_table:add_to_some_val(value) 18 | self.some_val = self.some_val + value 19 | end 20 | 21 | function print_some_val() 22 | print("some_table.some_val = " .. some_table.some_val) 23 | end 24 | )"); 25 | 26 | // do some printing 27 | lua["print_some_val"](); 28 | // 100 29 | 30 | sol::table self = lua["some_table"]; 31 | self["add_to_some_val"](self, 10); 32 | lua["print_some_val"](); 33 | 34 | std::cout << std::endl; 35 | 36 | return 0; 37 | } -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/set_and_get_variables_exists.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | lua.open_libraries(sol::lib::base); 8 | 9 | lua.script("exists = 250"); 10 | 11 | int first_try = lua.get_or("exists", 322); 12 | SOL_ASSERT(first_try == 250); 13 | 14 | lua.set("exists", sol::lua_nil); 15 | int second_try = lua.get_or("exists", 322); 16 | SOL_ASSERT(second_try == 322); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /examples/source/tutorials/quick_n_dirty/tables_and_nesting.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | 5 | int main(int, char*[]) { 6 | 7 | sol::state lua; 8 | lua.open_libraries(sol::lib::base); 9 | 10 | lua.script(R"( 11 | abc = { [0] = 24 } 12 | def = { 13 | ghi = { 14 | bark = 50, 15 | woof = abc 16 | } 17 | } 18 | )"); 19 | 20 | sol::table abc = lua["abc"]; 21 | sol::table def = lua["def"]; 22 | sol::table ghi = lua["def"]["ghi"]; 23 | 24 | int bark1 = def["ghi"]["bark"]; 25 | int bark2 = lua["def"]["ghi"]["bark"]; 26 | SOL_ASSERT(bark1 == 50); 27 | SOL_ASSERT(bark2 == 50); 28 | 29 | int abcval1 = abc[0]; 30 | int abcval2 = ghi["woof"][0]; 31 | SOL_ASSERT(abcval1 == 24); 32 | SOL_ASSERT(abcval2 == 24); 33 | 34 | sol::optional will_not_error 35 | = lua["abc"]["DOESNOTEXIST"]["ghi"]; 36 | SOL_ASSERT(will_not_error == sol::nullopt); 37 | 38 | int also_will_not_error 39 | = lua["abc"]["def"]["ghi"]["jklm"].get_or(25); 40 | SOL_ASSERT(also_will_not_error == 25); 41 | 42 | // if you don't go safe, 43 | // will throw (or do at_panic if no exceptions) 44 | // int aaaahhh = lua["boom"]["the_dynamite"]; 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /examples/source/tutorials/reading_functions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | int main() { 5 | 6 | sol::state lua; 7 | 8 | lua.script(R"( 9 | function f (a) 10 | return a + 5 11 | end 12 | )"); 13 | 14 | // Get and immediately call 15 | int x = lua["f"](30); 16 | SOL_ASSERT(x == 35); 17 | 18 | // Store it into a variable first, then call 19 | sol::unsafe_function f = lua["f"]; 20 | int y = f(20); 21 | SOL_ASSERT(y == 25); 22 | 23 | // Store it into a variable first, then call 24 | sol::protected_function safe_f = lua["f"]; 25 | int z = safe_f(45); 26 | SOL_ASSERT(z == 50); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/source/tutorials/write_variables_demo.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | 8 | sol::state lua; 9 | 10 | // open those basic lua libraries 11 | // again, for print() and other basic utilities 12 | lua.open_libraries(sol::lib::base); 13 | 14 | // value in the global table 15 | lua["bark"] = 50; 16 | 17 | // a table being created in the global table 18 | lua["some_table"] = lua.create_table_with("key0", 19 | 24, 20 | "key1", 21 | 25, 22 | lua["bark"], 23 | "the key is 50 and this string is its value!"); 24 | 25 | // Run a plain ol' string of lua code 26 | // Note you can interact with things set through sol in C++ 27 | // with lua! Using a "Raw String Literal" to have multi-line 28 | // goodness: 29 | // http://en.cppreference.com/w/cpp/language/string_literal 30 | lua.script(R"( 31 | 32 | print(some_table[50]) 33 | print(some_table["key0"]) 34 | print(some_table["key1"]) 35 | 36 | -- a lua comment: access a global in a lua script with the _G table 37 | print(_G["bark"]) 38 | 39 | )"); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /examples/source/tutorials/writing_functions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | std::string my_function(int D_count, std::string original) { 5 | // Create a string with the letter 'D' "D_count" times, 6 | // append it to 'original' 7 | return original + std::string(D_count, 'D'); 8 | } 9 | 10 | int main() { 11 | 12 | sol::state lua; 13 | 14 | lua["my_func"] = my_function; // way 1 15 | lua.set("my_func", my_function); // way 2 16 | lua.set_function("my_func", my_function); // way 3 17 | 18 | // This function is now accessible as 'my_func' in 19 | // lua scripts / code run on this state: 20 | lua.script("some_str = my_func(1, 'Da')"); 21 | 22 | // Read out the global variable we stored in 'some_str' in 23 | // the quick lua code we just executed 24 | std::string some_str = lua["some_str"]; 25 | SOL_ASSERT(some_str == "DaD"); 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /examples/source/tutorials/writing_overloaded_template_functions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | template 5 | auto my_add(A a, B b) { 6 | return a + b; 7 | } 8 | 9 | int main() { 10 | 11 | sol::state lua; 12 | 13 | auto int_function_pointer = &my_add; 14 | auto string_function_pointer 15 | = &my_add; 16 | // adds 2 integers, or "adds" (concatenates) two strings 17 | lua["my_combine"] = sol::overload( 18 | int_function_pointer, string_function_pointer); 19 | 20 | lua.script("my_num = my_combine(1, 2)"); 21 | lua.script( 22 | "my_str = my_combine('bark bark', ' woof woof')"); 23 | int my_num = lua["my_num"]; 24 | std::string my_str = lua["my_str"]; 25 | SOL_ASSERT(my_num == 3); 26 | SOL_ASSERT(my_str == "bark bark woof woof"); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/source/tutorials/writing_template_functions.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | template 5 | auto my_add(A a, B b) { 6 | return a + b; 7 | } 8 | 9 | int main() { 10 | 11 | sol::state lua; 12 | 13 | // adds 2 integers 14 | auto int_function_pointer = &my_add; 15 | lua["my_int_add"] = int_function_pointer; 16 | 17 | // concatenates 2 strings 18 | auto string_function_pointer 19 | = &my_add; 20 | lua["my_string_combine"] = string_function_pointer; 21 | 22 | lua.script("my_num = my_int_add(1, 2)"); 23 | int my_num = lua["my_num"]; 24 | SOL_ASSERT(my_num == 3); 25 | 26 | lua.script( 27 | "my_str = my_string_combine('bark bark', ' woof " 28 | "woof')"); 29 | std::string my_str = lua["my_str"]; 30 | SOL_ASSERT(my_str == "bark bark woof woof"); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /examples/source/variables.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | std::cout << "=== variables ===" << std::endl; 8 | 9 | sol::state lua; 10 | 11 | // need the base library for assertions 12 | lua.open_libraries(sol::lib::base); 13 | 14 | // basic setting of a variable 15 | // through multiple ways 16 | lua["x"] = 10; 17 | lua.set("y", "hello"); 18 | 19 | // assert values are as given 20 | lua.script("assert(x == 10)"); 21 | lua.script("assert(y == 'hello')"); 22 | 23 | 24 | // basic retrieval of a variable 25 | // through multiple ways 26 | int x = lua["x"]; 27 | auto y = lua.get("y"); 28 | 29 | int x2; 30 | std::string y2; 31 | std::tie(x2, y2) = lua.get("x", "y"); 32 | 33 | // show the values 34 | std::cout << x << std::endl; 35 | std::cout << y << std::endl; 36 | std::cout << x2 << std::endl; 37 | std::cout << y2 << std::endl; 38 | std::cout << std::endl; 39 | } -------------------------------------------------------------------------------- /examples/source/variadic_args_shifted.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main() { 7 | 8 | std::cout << "=== variadic_args shifting constructor ===" 9 | << std::endl; 10 | 11 | sol::state lua; 12 | lua.open_libraries(sol::lib::base); 13 | 14 | lua.set_function("f", [](sol::variadic_args va) { 15 | int r = 0; 16 | sol::variadic_args shifted_va(va.lua_state(), 3); 17 | for (auto v : shifted_va) { 18 | int value = v; 19 | r += value; 20 | } 21 | return r; 22 | }); 23 | 24 | lua.script("x = f(1, 2, 3, 4)"); 25 | lua.script("x2 = f(8, 200, 3, 4)"); 26 | lua.script("x3 = f(1, 2, 3, 4, 5, 6)"); 27 | 28 | lua.script("print(x)"); // 7 29 | lua.script("print(x2)"); // 7 30 | lua.script("print(x3)"); // 18 31 | 32 | std::cout << std::endl; 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /examples/source/variadic_args_storage.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int main() { 8 | 9 | std::cout << "=== variadic_args serialization/storage ===" 10 | << std::endl; 11 | 12 | sol::state lua; 13 | lua.open_libraries(sol::lib::base); 14 | 15 | std::function function_storage; 16 | 17 | auto store_routine = [&function_storage](sol::function f, 18 | sol::variadic_args va) { 19 | function_storage = 20 | [f, 21 | args = std::vector(va.begin(), 22 | va.end())]() { f(sol::as_args(args)); }; 23 | }; 24 | 25 | lua.set_function("store_routine", store_routine); 26 | 27 | lua.script(R"( 28 | function a(name) 29 | print(name) 30 | end 31 | store_routine(a, "some name") 32 | )"); 33 | function_storage(); 34 | 35 | lua.script(R"( 36 | function b(number, text) 37 | print(number, "of", text) 38 | end 39 | store_routine(b, 20, "these apples") 40 | )"); 41 | function_storage(); 42 | 43 | std::cout << std::endl; 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /examples/source/wip/lua_inheritance.cpp: -------------------------------------------------------------------------------- 1 | #define SOL_ALL_SAFETIES_ON 1 2 | #include 3 | 4 | #include 5 | 6 | int main(int, char*[]) { 7 | std::cout << "=== lua inheritance ===" << std::endl; 8 | 9 | sol::state lua; 10 | lua.open_libraries(sol::lib::base); 11 | 12 | /* This example is currently under construction. 13 | For inheritance and classes within Lua, 14 | consider using kikito's middleclass 15 | -- https://github.com/kikito/middleclass */ 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /include/sol/compatibility/compat-5.4.h: -------------------------------------------------------------------------------- 1 | #ifndef NOT_KEPLER_PROJECT_COMPAT54_H_ 2 | #define NOT_KEPLER_PROJECT_COMPAT54_H_ 3 | 4 | #if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP) 5 | extern "C" { 6 | #endif 7 | #if __has_include() 8 | #include 9 | #include 10 | #include 11 | #else 12 | #include 13 | #include 14 | #include 15 | #endif 16 | #if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP) 17 | } 18 | #endif 19 | 20 | #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM == 504 21 | 22 | #if !defined(LUA_ERRGCMM) 23 | /* So Lua 5.4 actually removes this, which breaks sol2... 24 | man, this API is quite unstable...! 25 | */ 26 | # define LUA_ERRGCMM (LUA_ERRERR + 2) 27 | #endif /* LUA_ERRGCMM define */ 28 | 29 | #endif // Lua 5.4 only 30 | 31 | #endif // NOT_KEPLER_PROJECT_COMPAT54_H_ -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('single', type: 'boolean', value: false, description: 'Generate the sol2 single header and expose the corresponding build targets') 2 | option('lua_cpp', type: 'boolean', value: false, description: 'Compile lua as C++ code') 3 | option('use_luajit', type: 'boolean', value: false, description: 'Search for luajit dep, implies lua_cpp=false') 4 | -------------------------------------------------------------------------------- /sol2.pc.in: -------------------------------------------------------------------------------- 1 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 2 | 3 | Name: sol2 4 | Description: C++ <-> Lua Wrapper Library 5 | Version: @sol2_VERSION@ 6 | Cflags: -I${includedir} 7 | -------------------------------------------------------------------------------- /subprojects/lua.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = lua-5.3.4 3 | 4 | source_url = https://www.lua.org/ftp/lua-5.3.4.tar.gz 5 | source_filename = lua-5.3.4.tar.gz 6 | source_hash = f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c 7 | 8 | patch_url = https://github.com/OrfeasZ/lua-meson/releases/download/v5.3.4/lua-5.3.4-wrap.zip 9 | patch_filename = lua-5.3.4-wrap.zip 10 | patch_hash = 400ca3e7f2a7e2a8363abe7a25f339b87488d56a1351ad843931a4d097624e57 -------------------------------------------------------------------------------- /tests/inclusion/source/as_args.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/as_returns.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/base_traits.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/bind_traits.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/bytecode.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/call.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/compatibility.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/compatibility/compat-5.3.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/config.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/coroutine.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/debug.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/demangle.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/deprecate.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/ebco.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/environment.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/error.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /tests/inclusion/source/error_handler.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/forward.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/forward_detail.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function_result.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function_types.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function_types_core.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function_types_stateful.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function_types_stateless.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/function_types_templated.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/in_place.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/inheritance.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/load_result.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/lua_table.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/lua_value.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/make_reference.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/metatable.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/object.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/object_base.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/optional.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/overload.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/policies.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/property.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/protect.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/protected_function.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/protected_handler.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/proxy.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/proxy_base.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/raii.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/reference.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/resolve.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/sol.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_field.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_guard.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_iterator.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_probe.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_proxy.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_proxy_base.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_push.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/stack_reference.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/state.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /tests/inclusion/source/state_view.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /tests/inclusion/source/string_view.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/table.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/table_core.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/table_iterator.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/thread.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/tie.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/traits.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/trampoline.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/tuple.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/types.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/unicode.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/unsafe_function.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/unsafe_function_result.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/userdata.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/usertype.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/usertype_container.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/usertype_core.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/usertype_proxy.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/usertype_storage.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/usertype_traits.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/utility/is_integer.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/utility/to_string.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/variadic_args.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/variadic_results.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/version.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/inclusion/source/wrapper.cpp: -------------------------------------------------------------------------------- 1 | // sol2 2 | 3 | // The MIT License (MIT) 4 | 5 | // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors 6 | 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /tests/lua_lifetime/source/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | sol::function fn; 4 | 5 | int main(int, char*[]) { 6 | sol::state lua; 7 | lua.open_libraries(sol::lib::base); 8 | fn = lua["print"]; 9 | fn.abandon(); 10 | return 0; 11 | } 12 | --------------------------------------------------------------------------------