Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update compat.lua #4118

Merged
merged 1 commit into from
Apr 5, 2023
Merged

Update compat.lua #4118

merged 1 commit into from
Apr 5, 2023

Conversation

EPuncker
Copy link
Contributor

@EPuncker EPuncker commented May 8, 2022

Pull Request Prelude

Changes Proposed

Added two functions to compat.lua that were deprecated or had its name changed in Lua 5.2

Issues addressed:
closes #4109

Copy link
Contributor

@Zbizu Zbizu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works, demo to test:

https://www.lua.org/cgi-bin/demo

t = {
[1] = 30,
["abc"] = 70,
[14] = 100,
["def"] = 10000
}

function table.maxn(t)
	local max = 0
	for k in pairs(t) do
		if type(k) == "number" and k > max then
			max = k
		end
	end
	return max
end

print(table.maxn(t))

@ranisalt
Copy link
Member

Doesn't Lua publish some global compatibility code? Since they make so many breaking changes from one version to the other, I feel like the language developers should provide that path

@EPuncker
Copy link
Contributor Author

Doesn't Lua publish some global compatibility code? Since they make so many breaking changes from one version to the other, I feel like the language developers should provide that path

there is this: http://lua-users.org/wiki/LuaVersionCompatibility but I don't know

@EPuncker EPuncker merged commit 5d37d6a into otland:master Apr 5, 2023
@EPuncker EPuncker deleted the compat2 branch April 5, 2023 04:12
EPuncker added a commit to EPuncker/forgottenserver that referenced this pull request May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table.maxn to compat.lua
5 participants