diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-05-01 20:13:47 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-05-02 16:19:42 +0530 |
| commit | 4afe7914a4d4f59703d14f9ba8470ed87831ddcb (patch) | |
| tree | 329a87cbcbf8fdecb491a9fb633d4cf3147e54d9 /src/LuaRuntime.cpp | |
| parent | 3f5325f59ba7f8552d093fdafd9674b713f3cad9 (diff) | |
| download | null-browser-4afe7914a4d4f59703d14f9ba8470ed87831ddcb.tar.gz null-browser-4afe7914a4d4f59703d14f9ba8470ed87831ddcb.zip | |
Add stdlib and web.utils
Diffstat (limited to '')
| -rw-r--r-- | src/LuaRuntime.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/LuaRuntime.cpp b/src/LuaRuntime.cpp index b4c39a2..73555e0 100644 --- a/src/LuaRuntime.cpp +++ b/src/LuaRuntime.cpp @@ -48,11 +48,15 @@ void LuaRuntime::init_web_api() { luaL_newlib(state, internals_api); lua_setglobal(state, internals_global_name); + require_module("null-browser.api"); +} + +void LuaRuntime::require_module(const QString &module_name) { preserve_top(state, { lua_getglobal(state, "require"); - lua_pushstring(state, "null-browser.api"); + lua_pushstring(state, module_name.toStdString().c_str()); if (lua_pcall(state, 1, 0, 0) != LUA_OK) { - qCritical() << "Unable to load browser api" << lua_tostring(state, -1); + qCritical() << "Unable to require module" << module_name << ":" << lua_tostring(state, -1); } }); } |
