Commit Graph
10 Commits
Author SHA1 Message Date
Thomas Watson 62e33f847b AP_Scripting: use luaL_checklstring instead of lua_tolstring in helpers
The latter returns a null pointer (and sets the string size to zero) if
the conversion fails, which the following code neglects to check,
potentially leading to null pointer dereferences.

Instead use the former, which throws a helpful type error if it fails
and doesn't expose the code to null pointers.
2025-05-18 11:59:24 +10:00
Andrew Tridgell 4a442d3b20 AP_Scripting: support DroneCAN messaging in lua
allow for sending broadcast messages, subscribing to broadcast
messages and sending requests
2025-05-09 13:08:40 +10:00
Thomas Watson e66d2a1495 AP_Scripting: remove redundant memsets
Matches current generator behavior.
2024-07-30 09:55:25 +10:00
Thomas Watson 837b17e82e AP_Scripting: more intelligently manage Lua stack
The Lua stack is guaranteed to have at least LUA_MINSTACK (default 20)
slots upon entry to C. Check to see if we might need more than that
minimum and only in that case call the function to check and resize the
stack. In virtually all cases the check can then be optimized away.

Additionally remove the redundant "Out of stack" message. Lua already
says "stack overflow" and a null message is valid.

Saves ~330B.
2024-07-30 09:55:25 +10:00
Andrew Tridgell a2459c6e61 AP_Scripting: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Peter Barker d519ab604e AP_Scripting: allow AP_SCRIPTING_ENABLED to come from hwdef files 2023-06-09 16:10:52 +10:00
Iampete1 41e36e3128 AP_Scripting: Parameter helper: allow optional param name in constructior 2022-09-14 13:59:40 +10:00
Iampete1 918b8a1a9c AP_Scripting: add binding and helper to get old params 2022-02-15 10:05:23 +11:00
Iampete1 37db2c5d4d AP_Scripting: Parameter helper: add configured and set defualt 2022-01-23 07:00:56 +11:00
Peter Hall 9dae370356 AP_Scripting: add param accesss helper 2021-01-05 10:55:36 +11:00