This is used when loading modules with require, lua must only look in enabled directory's
| 1093 | |
| 1094 | // This is used when loading modules with require, lua must only look in enabled directory's |
| 1095 | const char* lua_get_modules_path() |
| 1096 | { |
| 1097 | #define LUA_PATH_ROMFS "@ROMFS/scripts/modules/?.lua;" "@ROMFS/scripts/modules/?/init.lua" |
| 1098 | #define LUA_PATH_SCRIPTS LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" |
| 1099 | |
| 1100 | uint16_t dir_disable = AP_Scripting::get_singleton()->get_disabled_dir(); |
| 1101 | dir_disable &= uint16_t(AP_Scripting::SCR_DIR::SCRIPTS) | uint16_t(AP_Scripting::SCR_DIR::ROMFS); |
| 1102 | if (dir_disable == 0) { |
| 1103 | // Both directory's are enabled, return both, ROMFS takes priority |
| 1104 | return LUA_PATH_ROMFS ";" LUA_PATH_SCRIPTS; |
| 1105 | } |
| 1106 | |
| 1107 | if ((dir_disable & uint16_t(AP_Scripting::SCR_DIR::SCRIPTS)) == 0) { |
| 1108 | // Only scripts enabled |
| 1109 | return LUA_PATH_SCRIPTS; |
| 1110 | } |
| 1111 | |
| 1112 | if ((dir_disable & uint16_t(AP_Scripting::SCR_DIR::ROMFS)) == 0) { |
| 1113 | // Only ROMFS enabled |
| 1114 | return LUA_PATH_ROMFS; |
| 1115 | } |
| 1116 | |
| 1117 | // Nothing enabled? |
| 1118 | return ""; |
| 1119 | } |
| 1120 | |
| 1121 | // Simple print to GCS or over CAN |
| 1122 | int lua_print(lua_State *L) { |
no test coverage detected