WeakAuras

WeakAuras

206M Downloads

attempt to index global 'aura_env' (a nil value)

Isdisbase opened this issue ยท 1 comments

commented

Description

Hello Everyone,

im using a function like
function aura_env.initLibs() print("init libs") aura_env.COM = LibStub:GetLibrary("AceComm-3.0") aura_env.SER = LibStub:GetLibrary("AceSerializer-3.0") aura_env.COM:RegisterComm(aura_env.regPrefix, aura_env.onCommReceived) end

The receive function looks like
`function aura_env.onCommReceived(prefix, data, channel)
local information = select(2, aura_env.SER:Deserialize(data))

end`

however the code is working fine, when i open the action tab of the weakaura so aura_env is getting initialized.

After i do a ReloadUI and after the function aura_env.initLibs() is called i receive messages on my receiver function.
Sadly im getting a nil error when this happens.

WeakAuras Version

WeakAuras 3.6.1

World of Warcraft Flavor

The Burning Crusade

Tested with only WeakAuras

  • Yes
  • No

Lua Error

Message: [string "Error in: TBC Raid Marking':'initialization"]:84: attempt to index global 'aura_env' (a nil value)
Time: Sun Aug 1 00:11:08 2021
Count: 2
Stack: [string "Error in: TBC Raid Marking':'initialization"]:84: attempt to index global 'aura_env' (a nil value)

Reproduction Steps

  1. Import the linked wa
  2. reload ui
  3. Mouseover any unit

Last Good Version

No response

Screenshots

No response

Export String

!WA:2!9vvZUTTrq4O6dPGOiiwfXOfTfGqf1qc1wOWoiaja5GOmvJt1FLIY2b9G8sUdL2gQDj2DPIvk6fHEON9JGo3t6rOh6zwJ(eKhH8e0DjPLTSL9ciX9Nz2z(M5B2PqJIJlIlI)ZVJZILHekW703T5HTTD8zHm(R3qnwGjIOq0ux4mzrJleJqy27EtNGabi)6hSar9hX4DzeQ0RUDBxBNiZRPXGagFmsoiAGKmgYxvi6X(XcjBSwI(ryKeCGjav(buSAxKK4FmblhzvtTKJ8Legv8mhHeXLgwekrU95y2GS74uVSVN9j)lkMJga0jv5WWUCiGCM5lnlHWya3cXFBjtJLsuVtl1zRSKXnPKWRePNTZ1frVmxedJGyAQxD1XcGIpKMHp1bLRyyQgHmFuOj5Q9v34V97PhL(hjyvFqocOMzdJ8VRiWl6PmtD24XTaHanekFBiVZkUSsbobfsEpu(AErfZDml5u7WdkL5MQl1q)Bn4Ir1MZb8bYeaxok3gQCgAht)rikfcRK7TRdTcie8LL37gU1bGyPJPVRkvmVkQK(3U7EpELMd0K4jkFPPJ4kcy5s69ndvhKdSBKVvQ0tg79IFe0AZr8PLlvZh0iC39R(d3uPmgWDO0YalFDQQZvoWqIqcC91F)jQvdYvYqTA4fOaKyKXmjNmCiWfpABE(0)Xsoncs28dIyV0ANEXbQlDXG6165oONBnh3edVxbOq5OLYKzyNEDTB2CrwzZGrem4OloXjBEwHLX6YPkSt1QvRCjtLYK3MTEBA6v5MLNXbzmNAk5XWs(2ARb0rCefFpMrjDQNz(svPD)UhuZ1EqRo97z35iBNb9BFOBPvvyfF7wvPxVq7sVkN3ntebHHhIfgzbpr0twR9UmqMMpmCOOXGWWkwff80Vcc85yWtLCCvNZFLDZUn6388yAEE0iAt9dCta3S1Tyy4VEq0xT23qZMK8nFur2boffEKItOWXVCUQmli7ryRoUUDAzfWOYOh3GtEV5phJWCvnMPR7CftqtlvVNAyfYq4Ju1ndvV(hTLZ44qjzBN0vNAXre8PEsuOc5BLSVHJFisi0ZSuXf)Sjk2VEYmTX6Pw8L5ThojR9WgZ5P2sJClPcj8Pzhui6BV7EeQNy8jAuTb)SCXN9oghFmhfn748jZ9zumjTXGb)xvjasWuRM2nCNlz(tYIkFA3NuIGVWbI4mCSpy2MeEHQdJQFvNOmvxeWvPREsD4zJpM1lRHElTl71RUJTDBpLPcidn2lMGxm(54oV95pTT30Fk67VBmGNQObe)bYrCqmIfINUilYupTVAHcf2yUQseWP95(JpBX1E0CROVGmKY4qUtARjF2CoJlo9CeLKj1ZsEuJKTSOmk83asOXaqhkh9WlWkYUwIucjxa6iLyMwgnOs6BngrOkDt6NC0dtoo5KK3OM(53CNIcN9R(0Q7vCY)DY))

commented

This isn't a help forum, but a bug tracker.

This isn't a bug.

For help visit our discord.

In this case, aura_env is only available inside the weakauras environment due to how it is implemented. If you need to use it in a callback, you need to assign it to a local variable.