WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Is there a way to find what version of Lua WoW is using? (https://www.wowinterface.com/forums/showthread.php?t=56923)

Mayron 12-24-18 01:20 PM

Is there a way to find what version of Lua WoW is using?
 
A common problem that plagues me is not being able to control what pairs and ipairs is targetting when used with metatables. I tend to use a "proxy" table attached to a metatable and use __newindex and __index to move all key and value pairs to a separate table to better control the behaviour of data being passed to and from the table.

But this breaks pairs and ipairs and I noticed that in Lua 5.2+ you can have metamethods for these functions:
http://lua-users.org/wiki/GeneralizedPairsAndIpairs

I was wondering if this is supported in WoW, or in general how can you find out the Lua version used in WoW. I will test this out after the holidays when I have some time but doubt WoW would support it tbh.

Mayron 12-24-18 01:28 PM

Damn. Managed to test it out and sadly it's not supported. Still, is there a way to find what version of Lua is being used?

Fizzlemizz 12-24-18 01:41 PM

The last reported update I know of was from 5.0 to 5.1 with patch 2.0.

Mayron 12-24-18 03:00 PM

Quote:

Originally Posted by Fizzlemizz (Post 331161)
The last reported update I know of was from 5.0 to 5.1 with patch 2.0.

Thank you, I thought that might be the case. Looks like there won't be an update for a very long time, if ever. I know it's a giant risk for any company to update something so critically important for such a popular, valuable product. Risk management would be put on edge and they aren't really gaining any big benefit from doing so.

jlam 12-24-18 08:30 PM

Quote:

Originally Posted by Mayron (Post 331162)
Thank you, I thought that might be the case. Looks like there won't be an update for a very long time, if ever. I know it's a giant risk for any company to update something so critically important for such a popular, valuable product. Risk management would be put on edge and they aren't really gaining any big benefit from doing so.

I doubt they will ever update the version of Lua (5.1.x) that is embedded into WoW. The changes from 5.1 to 5.2 with function environments will probably break too many things that were written with that in mind.

You should be able to write your own table class with its own iterators, though they will never be seamlessly dropped in place of normal tables.

Mayron 12-25-18 02:29 AM

Quote:

Originally Posted by jlam (Post 331163)
You should be able to write your own table class with its own iterators, though they will never be seamlessly dropped in place of normal tables.

I was going to do that but there are many helper functions I use which use pairs and ipairs so rather than try to avoid them I decided to add a "GetTable" method to my "proxy table" to get the "real table" that my proxy table communicates with, and then just pass the real table to these functions and pairs/ipairs.

That'll have to do for now. I've heard that 5.1 supports a metamethod for __next but I'd rather not have to always use next() for everything just for the sake of being safe.

thomasjohnshannon 12-30-18 06:58 PM

For future reference you can check the lua version in game with the following line. And as previously stated they are still running Lua 5.1.

Lua Code:
  1. /script print(_VERSION)


All times are GMT -6. The time now is 08:06 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI