Skip to content

Commit b258062

Browse files
committed
Set singletons using sol
1 parent 0478360 commit b258062

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/luaopen/singleton_access.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,17 @@
1919
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
* SOFTWARE.
2121
*/
22-
#include "../utils/convert_godot_lua.hpp"
22+
#include "../utils/custom_sol.hpp"
2323

2424
#include <godot_cpp/classes/engine.hpp>
25-
#include <sol/sol.hpp>
2625

2726
using namespace godot;
28-
using namespace luagdextension;
2927

3028
extern "C" int luaopen_godot_singleton_access(lua_State *L) {
29+
sol::state_view state(L);
3130
Engine *engine = Engine::get_singleton();
3231
for (auto&& singleton_name : engine->get_singleton_list()) {
33-
lua_push(L, engine->get_singleton(singleton_name));
34-
lua_setglobal(L, singleton_name.ascii().get_data());
32+
state.set(singleton_name.ascii().get_data(), engine->get_singleton(singleton_name));
3533
}
36-
3734
return 0;
3835
}

0 commit comments

Comments
 (0)