AP_Scripting: docs: remove incorrect camera creation function

This commit is contained in:
Iampete1 2024-12-21 03:49:26 +00:00
parent d31caf4378
commit f2b40601c9
2 changed files with 36 additions and 34 deletions

View File

@ -1395,9 +1395,6 @@ function camera:take_picture(instance) end
---@class (exact) AP_Camera__camera_state_t_ud
local AP_Camera__camera_state_t_ud = {}
---@return AP_Camera__camera_state_t_ud
function AP_Camera__camera_state_t() end
-- get field
---@return Vector2f_ud
function AP_Camera__camera_state_t_ud:tracking_p1() end

View File

@ -2578,20 +2578,14 @@ void emit_loaders(void) {
fprintf(source, "}\n\n");
}
void emit_userdata_new_funcs(void) {
struct userdata *data = parsed_userdata;
fprintf(source, "const struct userdata {\n");
fprintf(source, " const char *name;\n");
fprintf(source, " const lua_CFunction fun;\n");
fprintf(source, "} new_userdata[] = {\n");
while (data) {
int should_emit_creation(struct userdata * data) {
// Dont expose creation function for all read only items
int expose_creation = FALSE;
if (data->creation || data->methods) {
// Custom creation or methods, if not specifically disabled
expose_creation = !(data->creation && data->creation_args == -1);
} else {
// Feilds only
// Fields only
struct userdata_field * field = data->fields;
while(field) {
if (field->access_flags & ACCESS_FLAG_WRITE) {
@ -2601,8 +2595,18 @@ void emit_userdata_new_funcs(void) {
field = field->next;
}
}
return expose_creation;
}
if (expose_creation) {
void emit_userdata_new_funcs(void) {
struct userdata *data = parsed_userdata;
fprintf(source, "const struct userdata {\n");
fprintf(source, " const char *name;\n");
fprintf(source, " const lua_CFunction fun;\n");
fprintf(source, "} new_userdata[] = {\n");
while (data) {
// Dont expose creation function for all read only items
if (should_emit_creation(data)) {
start_dependency(source, data->dependency);
if (data->creation) {
// expose custom creation function to user (not used internally)
@ -2885,6 +2889,7 @@ void emit_docs(struct userdata *node, int is_userdata, int emit_creation) {
}
if (is_userdata) {
if (should_emit_creation(node)) {
// local userdata
fprintf(docs, "local %s = {}\n\n", name);
@ -2910,7 +2915,7 @@ void emit_docs(struct userdata *node, int is_userdata, int emit_creation) {
}
fprintf(docs, ") end\n\n");
}
}
}
} else {
// global