Here's a small modification to luascript.c that I use to keep the backlight off after set_backlight(0). It might make a nice addition to the trunk, just to keep from having to answer so many questions about set_backlight(0)
static int bldark=0; //flags backlight off
static int luaCB_set_backlight( lua_State* L )
{
bldark = (luaL_checknumber(L,1)==0);
//if (bldark) TurnOffBackLight();
//else TurnOnBackLight();
if (!bldark) TurnOnBackLight(); //else will turn off next yield
return 0;
}
// run a timeslice of lua script
int lua_script_run(void)
{
int Lres;
int top;
if (run_first_resume) {
run_first_resume = 0;
top = 0;
bldark=0;
} else {
top = lua_gettop(Lt);
}
run_start_tick = get_tick_count();
run_hook_count = 0;
if (bldark) TurnOffBackLight();
Lres = lua_resume( Lt, top );
if (Lres == LUA_YIELD)return SCRIPT_RUN_RUNNING; //yielded
bldark=0;
TurnOnBackLight();
if (Lres != 0)return lua_script_error(Lt,1);
// finished normally, add ptp result
lua_script_finish(Lt);
// Display 'Finished message', unless running from PTP
if (lua_script_is_ptp == 0)
script_console_add_line(LANG_CONSOLE_TEXT_FINISHED);
return SCRIPT_RUN_ENDED;
}