scenario:
x =
Before this commit we get an error. We can't let the definition of a name be empty. Just delete it for now to bring the driver in sync with the app.
IPA7EFXT6X46DJ3HJVJWIPBVZVGNS2KGYJGVAFIUCSH2ZKKYS26AC
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def_editor in pairs(Definitions) do
local def = get_definition_from_app(name)
if def == '' then
-- app doesn't know about this definition
-- just delete it from the driver for now
Definitions[name] = nil
else
def_editor.data = load_from_iterator(def:gmatch("[^\r\n]+"))
end
end
end
{"box_height":680,"maybe_update_key_in_definitions":529,"load_definition":716,"on.code_change":734,"on.save_settings":742,"on.load_settings":776,"on_handle":547,"table_and_array_both_empty":689,"scale":712,"on_text":539,"on.mouse_press":722,"initialize_editor":678,"sx":544,"Cursor_node":172,"vx":545,"line_height":365,"on.key_release":720,"fw_parent":775,"on":1,"fw_app":"driver","Mouse_cursor":559,"Animating":770,"set_mouse_cursor":562,"draw_ticks":663,"order_of_magnitude":573,"approximate":579,"Menu_background_color":611,"sy":469,"Menu_border_color":612,"Surface":422,"Menu_command_color":613,"Menu_highlight_color":614,"approximate_up":658,"draw_menu_bar":641,"manifest_index":637,"Viewport":604,"on.draw":565,"Ticks_font":669,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765,"num_lines_for_manifest_navigator":676,"on.code_submit":766,"copy_shape":396,"reset_manifest_navigator":772,"manifest_coord":636,"on.mouse_release":721,"load_from_iterator":670,"on.update":741,"get_definition_from_app":775,"on.keychord_press":774,"mouse_cursor":558,"font":353,"add_thick_line":400,"Manifest":769,"manifest_navigator_up":628,"manifest_navigator_down":635,"load_manifest":694,"A":713,"get_manifest":768,"draw_cursor":639,"move_candidate_to_front_of_manifest":632,"add_hotkey_to_menu":616,"on.initialize":695,"initialize_manifest_navigator":773,"text_input_on_manifest_navigator":634,"Definitions":503,"delete_definition":673,"new_definition":767,"B":379,"tick_spec":660,"schema1_of_y":667,"manifest_navigator_candidates":638,"compute_layout":385,"vy":546,"add_def_to_menu":640,"update_editor_box":711,"draw_manifest_navigator":677,"y_of_schema1":364,"Page":475,"on.text_input":521}
{"box_height":680,"maybe_update_key_in_definitions":529,"load_definition":716,"on.code_change":734,"on.save_settings":742,"on.load_settings":700,"on_handle":547,"table_and_array_both_empty":689,"scale":712,"on_text":539,"on.mouse_press":722,"initialize_editor":678,"sx":544,"Cursor_node":172,"vx":545,"line_height":365,"on.key_release":720,"fw_parent":774,"on":1,"fw_app":"driver","Mouse_cursor":559,"Animating":770,"set_mouse_cursor":562,"draw_ticks":663,"order_of_magnitude":573,"approximate":579,"Menu_background_color":611,"sy":469,"Menu_border_color":612,"Surface":422,"Menu_command_color":613,"Menu_highlight_color":614,"approximate_up":658,"draw_menu_bar":641,"manifest_index":637,"Viewport":604,"on.draw":565,"Ticks_font":669,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765,"num_lines_for_manifest_navigator":676,"on.code_submit":766,"copy_shape":396,"reset_manifest_navigator":772,"manifest_coord":636,"on.mouse_release":721,"load_from_iterator":670,"on.update":741,"get_definition_from_app":775,"on.keychord_press":774,"mouse_cursor":558,"font":353,"add_thick_line":400,"Manifest":769,"manifest_navigator_up":628,"manifest_navigator_down":635,"load_manifest":694,"A":713,"get_manifest":768,"draw_cursor":639,"move_candidate_to_front_of_manifest":632,"add_hotkey_to_menu":616,"on.initialize":695,"initialize_manifest_navigator":773,"text_input_on_manifest_navigator":634,"Definitions":503,"delete_definition":673,"new_definition":767,"B":379,"tick_spec":660,"schema1_of_y":667,"manifest_navigator_candidates":638,"compute_layout":385,"vy":546,"add_def_to_menu":640,"update_editor_box":711,"draw_manifest_navigator":677,"y_of_schema1":364,"Page":475,"on.text_input":521}
get_definition_from_app = function(name)
-- return definition for a name
-- if no such definition, return ''
live.send_to_app('GET '..name)
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
return response_string
end