diff options
author | Andy Belle-Isle <abelleisle@protonmail.com> | 2022-11-13 13:55:26 -0600 |
---|---|---|
committer | Andy Belle-Isle <abelleisle@protonmail.com> | 2022-11-13 13:55:26 -0600 |
commit | 38e2036d031bdeaea76ef4b6c3c2af5247ed93ec (patch) | |
tree | b1401ba2ef33d08dbc528aadbf61f0d4aedad63d /lib/sol2/examples/source/this_state.cpp | |
parent | 57a1eb6fdccb9023557d0a470796f423f063948a (diff) | |
parent | 57013add5b7c524086272be7d395f9ec5109bde2 (diff) |
Merge remote-tracking branch 'origin/lib-cleanup' into world
Diffstat (limited to 'lib/sol2/examples/source/this_state.cpp')
-rw-r--r-- | lib/sol2/examples/source/this_state.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/sol2/examples/source/this_state.cpp b/lib/sol2/examples/source/this_state.cpp deleted file mode 100644 index 9dd91f0..0000000 --- a/lib/sol2/examples/source/this_state.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#define SOL_ALL_SAFETIES_ON 1
-#include <sol/sol.hpp>
-
-#include "assert.hpp"
-
-int main () {
- sol::state lua;
-
- lua.set_function("bark", []( sol::this_state s, int a, int b ){
- lua_State* L = s; // current state
- return a + b + lua_gettop(L);
- });
-
- lua.script("first = bark(2, 2)"); // only takes 2 arguments, NOT 3
-
- // Can be at the end, too, or in the middle: doesn't matter
- lua.set_function("bark", []( int a, int b, sol::this_state s ){
- lua_State* L = s; // current state
- return a + b + lua_gettop(L);
- });
-
- lua.script("second = bark(2, 2)"); // only takes 2 arguments
- int first = lua["first"];
- c_assert(first == 6);
- int second = lua["second"];
- c_assert(second == 6);
-
- return 0;
-}
\ No newline at end of file |