-
-
Notifications
You must be signed in to change notification settings - Fork 483
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Describe the bug
When you use dbQuery
as async with a callback, and you want to pass a function in the callbackArguments
parameter table, it will become nil
in the callback function.
function sayHello()
print("Hello!")
end
dbQuery(function(qh, func)
local result = dbPoll(qh, 0)
func() -- You will get an error here, func will be nil
end, {sayHello}, dbConnection, "...")
Steps to reproduce
- Use async
dbQuery
with a callback - Use the
callbackArguments
param, try to pass a function in that table - Check the passed arg in the callback function, it will be
nil
Version
Server: 1.6-release-23312
Additional context
I guess it happens because you can't reference that function after, even though it's the same resource, not sure how easy (or possible at all) a fix would be.
You could handle it in Lua every time, by storing the function in a global/top scope table and pass the index reference the function from that table (or even sending the function name and using _G), but it quickly becomes a hassle.
Relevant log output
Security Policy
- I have read and understood the Security Policy and this issue is not security related.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request