I really don't understand why you find it hard to understand... It's all explained in the documentation...
OnLuaFloaterOpen() is only called for a Lua floater,
when you open it. This callback is used to setup Lua UI elements callbacks, or do things you want only to do once for the lifetime of the Lua floater.
OnLuaFloaterAction() is called each time the user performs an
action on an UI element (which names follows the naming convention for each type, such as "buttonN" for buttons) of a Lua floater: it is for doing exactly what you want to do here, i.e. react to a click on a button to trigger a custom Lua function/piece of code.
They are BOTH executed in the same "context" (or rather in the same "Lua state", i.e. the same Lua script instance), the one of the automation script.
However, the Lua commands you set on UI elements (either via
SetLuaFloaterCommand() from the automation script and usually inside a
OnLuaFloaterOpen() callback, or from a
lua_command="SomeLuaScriptLine" in the UI element XUI definition) are executed in a temporary/transitory Lua state different from the automation script, so you cannot directly call functions defined in the latter from these commands.