Here are the proposed code changes. It looks like I can reset the now_flag in lua_script_start() instead of adding a function to call from script.c. Also, I named the function "set_now_flag()" instead of "set_now()." My reaction to "set_now()" was, "set_what_now()?"
static int now_flag=0;
static int when()
{
if(now_flag&&shooting_in_progress())return SET_NOW;
return SET_LATER;
}
...
int lua_script_start( char const* script, int ptp )
{
now_flag=0; //set_tv,sv,av default to SET_LATER
...
static int luaCB_set_now_flag( lua_State* L )
{
now_flag = luaL_checknumber( L, 1 ) != 0;
//set_now_flag(1) means all calls to set_tv,sv,av functions take place immediately if shooting_in_progress()
return 0;
}
static int luaCB_set_sv96( lua_State* L )
{
shooting_set_sv96(luaL_checknumber( L, 1 ), when());
return 0;
}
static int luaCB_set_tv96_direct( lua_State* L )
{
shooting_set_tv96_direct(luaL_checknumber( L, 1 ), when());
return 0;
}
static int luaCB_set_tv96( lua_State* L )
{
shooting_set_tv96(luaL_checknumber( L, 1 ), when());
return 0;
}
static int luaCB_set_iso_real( lua_State* L )
{
shooting_set_iso_real( luaL_checknumber( L, 1 ), when());
return 0;
}
static int luaCB_set_av96_direct( lua_State* L )
{
shooting_set_av96_direct( luaL_checknumber( L, 1 ), when() );
return 0;
}
static int luaCB_set_av96( lua_State* L )
{
shooting_set_av96( luaL_checknumber( L, 1 ), when() );
return 0;
}
static int luaCB_set_nd_filter( lua_State* L )
{
shooting_set_nd_filter_state( luaL_checknumber( L, 1 ), when());
return 0;
}
...
FUNC(set_now_flag)
[edit] I just tested the above routines with my time lapse script and set_tv96_direct(tv). It worked fine, just like with propcases, as expected. I need to test it with set_sv96(sv) to see if that also works as expected.