|
| 1 | +/** |
| 2 | + @file |
| 3 | + @brief Implementation |
| 4 | +
|
| 5 | + @date 2012 |
| 6 | +
|
| 7 | + @author |
| 8 | + Ryan Pavlik |
| 9 | + |
| 10 | + http://academic.cleardefinition.com/ |
| 11 | + Iowa State University Virtual Reality Applications Center |
| 12 | + Human-Computer Interaction Graduate Program |
| 13 | +*/ |
| 14 | + |
| 15 | +// Copyright Iowa State University 2012. |
| 16 | +// Permission is hereby granted, free of charge, to any person obtaining a |
| 17 | +// copy of this software and associated documentation files (the "Software"), |
| 18 | +// to deal in the Software without restriction, including without limitation |
| 19 | +// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 20 | +// and/or sell copies of the Software, and to permit persons to whom the |
| 21 | +// Software is furnished to do so, subject to the following conditions: |
| 22 | + |
| 23 | +// The above copyright notice and this permission notice shall be included |
| 24 | +// in all copies or substantial portions of the Software. |
| 25 | + |
| 26 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF |
| 27 | +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
| 28 | +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
| 29 | +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 30 | +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR |
| 31 | +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 32 | +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 33 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE |
| 34 | +// OR OTHER DEALINGS IN THE SOFTWARE. |
| 35 | + |
| 36 | +// Internal Includes |
| 37 | +#include <luabind/set_package_preload.hpp> |
| 38 | +#include <luabind/object.hpp> |
| 39 | + |
| 40 | +// Library/third-party includes |
| 41 | +// - none |
| 42 | + |
| 43 | +// Standard includes |
| 44 | +// - none |
| 45 | + |
| 46 | + |
| 47 | +namespace luabind { |
| 48 | + LUABIND_API void set_package_preload(lua_State * L, const char * modulename, int (*loader) (lua_State *)) { |
| 49 | + rawget(rawget(globals(L), "package"), "preload").push(L); |
| 50 | + lua_pushcclosure(L, loader, 0); |
| 51 | + lua_setfield(L, -2, modulename); |
| 52 | + lua_pop(L, 1); |
| 53 | + } |
| 54 | + |
| 55 | +} // namespace luabind |
0 commit comments