13 auto msg = luaL_checkstring(l, 1);
20 efiPrintf(
"LUA: %s", msg);
26 auto x1 = luaL_checknumber(l, 1);
27 auto y1 = luaL_checknumber(l, 2);
28 auto x2 = luaL_checknumber(l, 3);
29 auto y2 = luaL_checknumber(l, 4);
30 auto x = luaL_checknumber(l, 5);
34 lua_pushnumber(l, result);
43 lua_register(lState,
"findCurveIndex", [](lua_State* l) {
44 auto name = luaL_checklstring(l, 1,
nullptr);
50 lua_pushnumber(l, result.Value + HUMAN_OFFSET);
55 lua_register(lState,
"findTableIndex",
57 auto name = luaL_checklstring(l, 1,
nullptr);
63 lua_pushnumber(l, index.Value + HUMAN_OFFSET);
68 lua_register(lState,
"findSetting",
70 auto name = luaL_checklstring(l, 1,
nullptr);
71 auto defaultValue = luaL_checknumber(l, 2);
75 lua_pushnumber(l, defaultValue);
83#ifndef STARTUP_STANDBY_PROHIBITED_PERIOD_SEC
84#define STARTUP_STANDBY_PROHIBITED_PERIOD_SEC 3
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");
114 intptr_t
offset = (intptr_t)ptr;
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x)
Linear interpolation by two points.
efitimesec_t getTimeNowS()
Current system time in seconds (32 bits)
static constexpr engine_configuration_s * engineConfiguration
void * hackEngineConfigurationPointer(void *ptr)
static int lua_efi_print(lua_State *l)
void configureRusefiLuaUtilHooks(lua_State *lState)
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]