bug: [1.7] Button Click events seems to produce a table instead of a string #55

Closed
opened 2023-05-03 01:25:13 +08:00 by ajh123 · 3 comments
ajh123 commented 2023-05-03 01:25:13 +08:00 (Migrated from github.com)

Describe the bug

When a button gets clicked, instead of a string like "mouse_click" or "mouse_up" the event (2nd parameter) is a table.

To Reproduce

Steps to reproduce the behavior:

  1. A small program can be used to test the behaviour:
local basalt = require("basalt")

local main = basalt.createFrame()

main:addButton()
:setText("Start")
:setPosition(1, 1)
:setSize("7", "1")
:onClick(function(self, event, button, x, y)
	basalt.debug("Event ("..tostring(event)..") = {")
	if type(event) == "table" then
		for k, v in pairs(event) do
			basalt.debug(k.."="..tostring(v)..",")
		end
	end
	basalt.debug("}")
end)

basalt.autoUpdate()
  1. Run the program.
  2. Click the "Start" button.
  3. Open the Basalt debug window.
  4. See something like the attached screenshot.

Expected behavior

Once the button is clicked, the Basalt debug window will contain:

Event (mouse_click) = {
}

Screenshots

If applicable, add screenshots to help explain your problem.

basalt_error2

^ The contents of the event.

Additional context

Add any other context about the problem here.
N/A ?

Checklist

[ X ] I am running the latest version.
Tick the box if you are running the latest version!

**Describe the bug** When a button gets clicked, instead of a string like `"mouse_click"` or `"mouse_up"` the `event` (2nd parameter) is a table. **To Reproduce** Steps to reproduce the behavior: 1. A small program can be used to test the behaviour: ```lua local basalt = require("basalt") local main = basalt.createFrame() main:addButton() :setText("Start") :setPosition(1, 1) :setSize("7", "1") :onClick(function(self, event, button, x, y) basalt.debug("Event ("..tostring(event)..") = {") if type(event) == "table" then for k, v in pairs(event) do basalt.debug(k.."="..tostring(v)..",") end end basalt.debug("}") end) basalt.autoUpdate() ``` 2. Run the program. 2. Click the "Start" button. 4. Open the Basalt debug window. 5. See something like the attached screenshot. **Expected behavior** Once the button is clicked, the Basalt debug window will contain: ``` Event (mouse_click) = { } ``` **Screenshots** If applicable, add screenshots to help explain your problem. ![basalt_error2](https://user-images.githubusercontent.com/41990982/235739094-26c5ba0d-3290-43c7-a4fa-147adcaa1a50.PNG) ^ The contents of the `event`. **Additional context** Add any other context about the problem here. N/A ? **Checklist** [ X ] I am running the latest version. Tick the box if you are running the latest version!
NoryiE commented 2023-05-04 03:49:10 +08:00 (Migrated from github.com)

Hello, thank you i will look into this asap!

Hello, thank you i will look into this asap!
NoryiE commented 2023-05-05 00:21:21 +08:00 (Migrated from github.com)

The issue should be fixed now! Here's the fix: a97254d

The issue should be fixed now! Here's the fix: [a97254d](https://github.com/Pyroxenium/Basalt/commit/a97254ddf781a96fadd7cf7f26efc5e8076fd8b3)
ajh123 commented 2023-05-07 20:48:25 +08:00 (Migrated from github.com)

Thanks, it works now.

Thanks, it works now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GitHub/Basalt#55
No description provided.