39 {
42
43 lua_register(lState, "findCurveIndex", [](lua_State* l) {
44 auto name = luaL_checklstring(l, 1, nullptr);
46 if (!result) {
47 lua_pushnil(l);
48 } else {
49
50 lua_pushnumber(l, result.Value + HUMAN_OFFSET);
51 }
52 return 1;
53 });
54
55 lua_register(lState, "findTableIndex",
56 [](lua_State* l) {
57 auto name = luaL_checklstring(l, 1, nullptr);
59 if (!index) {
60 lua_pushnil(l);
61 } else {
62
63 lua_pushnumber(l, index.Value + HUMAN_OFFSET);
64 }
65 return 1;
66 });
67
68 lua_register(lState, "findSetting",
69 [](lua_State* l) {
70 auto name = luaL_checklstring(l, 1, nullptr);
71 auto defaultValue = luaL_checknumber(l, 2);
72
74 if (!index) {
75 lua_pushnumber(l, defaultValue);
76 } else {
77
79 }
80 return 1;
81 });
82
83#ifndef STARTUP_STANDBY_PROHIBITED_PERIOD_SEC
84#define STARTUP_STANDBY_PROHIBITED_PERIOD_SEC 3
85#endif
86
87
88
89#if defined(LUA_STM32_STANDBY)
90 lua_register(lState, "mcu_standby", [](lua_State*) {
91 if (
getTimeNowS() < STARTUP_STANDBY_PROHIBITED_PERIOD_SEC) {
92 criticalError("mcu_standby invoked right on start");
93 return 0;
94 }
97 return 0;
98 });
99#endif
100
101
102
103
104
105
106
107
108
109}
efitimesec_t getTimeNowS()
Current system time in seconds (32 bits)
static constexpr engine_configuration_s * engineConfiguration
static int lua_efi_print(lua_State *l)
static int lua_interpolate(lua_State *l)
expected< int > getSettingIndexByName(const char *name)
expected< int > getTableIndexByName(const char *name)
expected< int > getCurveIndexByName(const char *name)
script_setting_t scriptSetting[SCRIPT_SETTING_COUNT]