how do I access config_open etc. from lua script?

Dan39

New Member
Hello,

Is it possible to call config_open, config_set_string, etc. functions from util/config-file.h within an lua script? What I want to do is change the Recording Path and/or Filename Formatting dynamically, like reading text from a filesystem file and then using that text in the filename. The text would be written by my own external shell script, so it would be safe to use, I don't have to worry about bad user input.

I tried calling obslua.config_open but I get an error that it is nil. I am guessing because it is in the separate util/config-file.h file that would need to be included some how. I am not sure how or if that is possible in lua script though.

Thanks,
Dan
 
Not all C functions are callable from Lua. The first parameter of config_open is a pointer-to-pointer, which is problematic in Lua, so someone would need to have provided a shim function with a different interface.

Beyond that, if you are trying to change ini files used by OBS such as global.ini or basic.ini, these calls would write to the file, but they wouldn't tell OBS to use the values that you just wrote. Then when OBS exited, it would likely write over your values as it saved current settings.
 

Dan39

New Member
Do you have any idea to do what I want then? I don't need to change the ini setting on disk, I just want to change it for the next Start Recording. Changing just the Recording Path would be fine too.
 
There are front-end functions like obs.obs_frontend_recording_start, _stop, and _active to let you start and stop recording, and see if a recording is active. But I don't immediately see anything to change the file or path.

There is an example in Python of timed start and stop at https://obsproject.com/forum/resources/obs-recording-manager.659/ You might search through other contributed scripts to see if someone has found a way to specify filename
 
Top