Skip to content

Commit 5000799

Browse files
committed
Allow patches only in GLOBAL
1 parent 6adc0a4 commit 5000799

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ print(obs_source_get_name(source))
4343
To access global the state of script do it via `_G`, when you write x = 5,
4444
only that instance of `Console` will have it
4545

46+
## Notes on exceptions and backups
47+
There might be exceptions in your code, it is recommended to add `print('start')` and `print('end')` statements to debug code in `Console`
48+
Make a backup of your scene collection.
49+
You can rename the script name from `console.lua` to something else if crashing on start.
50+
51+
---
4652
# Auto run
4753
If you check `Auto run` then code from this console will be executed automatically
4854
when OBS starts
@@ -460,9 +466,6 @@ error('done') else error('not done') end
460466

461467
`click_property_filter_ffi(source, filter_name, prop_name)` - This will press `Execute!` button `click_property_filter_ffi(source, "Console", "button1")`
462468

463-
# Notes on exceptions
464-
There might be exceptions in your code, it is recommended to add `print('start')` and `print('end')` statements to debug code in `Console`
465-
466469
# Snippets
467470
* `On/off sceneitem every 2.5 seconds` - source must be a scene
468471
* `Loop media source between start and end via hotkey` - adds two hotkeys to set and clear loop (`1;` and `2;`)

console.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Contact/URL https://www.github.com/upgradeQ/libre-macros
44
Copyright (C) 2021-2025 upgradeQ
55
Distributed under AGPL license <https://spdx.org/licenses/AGPL-3.0-or-later.html>
66
]]
7-
_ver = "4.1.0"
7+
_ver = "4.1.1"
88
print('[+] libre-macros https://www.github.com/upgradeQ/libre-macros' .. ' ' .. _ver)
99
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~BOOKMARKSwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
1010
-- localization - below
@@ -2159,6 +2159,9 @@ function script_load(settings)
21592159
if not ok then
21602160
print('[+]' .. i18n"s_patch_err")
21612161
end
2162+
local not_allowed_to_run_in_console_instance = function() error('[ERROR] must be in GLOBAL') end
2163+
_G.patch_bs_js = not_allowed_to_run_in_console_instance
2164+
21622165
i18n.set_locale(obs_data_get_string(settings, "_lang")) -- must load first
21632166

21642167
local as_video_filter = SourceDef:new({id = "v_console_source", type = OBS_SOURCE_TYPE_FILTER, output_flags = bit.bor(OBS_SOURCE_VIDEO),})

0 commit comments

Comments
 (0)