diff options
| -rw-r--r-- | src/lanes.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lanes.c b/src/lanes.c index 8edf47b..092e282 100644 --- a/src/lanes.c +++ b/src/lanes.c | |||
| @@ -2611,12 +2611,22 @@ int | |||
| 2611 | #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) | 2611 | #if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) |
| 2612 | __declspec(dllexport) | 2612 | __declspec(dllexport) |
| 2613 | #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) | 2613 | #endif // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) |
| 2614 | luaopen_lanes_core( lua_State *L ) | 2614 | luaopen_lanes_core( lua_State* L) |
| 2615 | { | 2615 | { |
| 2616 | // Create main module interface table | ||
| 2617 | // we only have 1 closure, which must be called to configure Lanes | ||
| 2618 | STACK_GROW( L, 3); | 2616 | STACK_GROW( L, 3); |
| 2619 | STACK_CHECK( L) | 2617 | STACK_CHECK( L) |
| 2618 | |||
| 2619 | // sanity check: let's see if _"VERSION" matches what we we built against | ||
| 2620 | lua_getglobal( L, "_VERSION"); | ||
| 2621 | lua_pushstring( L, LUA_VERSION_NUM == 501 ? "Lua 5.1" : "Lua 5.2"); | ||
| 2622 | if( !lua_rawequal( L, -1, -2)) | ||
| 2623 | { | ||
| 2624 | return luaL_error( L, "Lanes is built against %s, but you are running %s", lua_tostring( L, -1), lua_tostring( L, -2)); | ||
| 2625 | } | ||
| 2626 | lua_pop( L, 2); | ||
| 2627 | |||
| 2628 | // Create main module interface table | ||
| 2629 | // we only have 1 closure, which must be called to configure Lanes | ||
| 2620 | lua_newtable(L); | 2630 | lua_newtable(L); |
| 2621 | lua_pushvalue(L, 1); // module name | 2631 | lua_pushvalue(L, 1); // module name |
| 2622 | lua_pushvalue(L, -2); // module table | 2632 | lua_pushvalue(L, -2); // module table |
| @@ -2631,6 +2641,7 @@ luaopen_lanes_core( lua_State *L ) | |||
| 2631 | lua_pushnil( L); // almost idem | 2641 | lua_pushnil( L); // almost idem |
| 2632 | lua_call( L, 2, 0); | 2642 | lua_call( L, 2, 0); |
| 2633 | } | 2643 | } |
| 2644 | |||
| 2634 | STACK_END( L, 1) | 2645 | STACK_END( L, 1) |
| 2635 | return 1; | 2646 | return 1; |
| 2636 | } | 2647 | } |
