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

Remove redundant type assertions in lua engine #166

Open
adatzer opened this issue Jul 5, 2022 · 0 comments
Open

Remove redundant type assertions in lua engine #166

adatzer opened this issue Jul 5, 2022 · 0 comments
Labels
cleanup Maintenance, cleaning up codebase or repo

Comments

@adatzer
Copy link
Contributor

adatzer commented Jul 5, 2022

The type assertions in the switch cases here and here could be removed by using the result of the type switch.

For example:

// before
switch val.(type) {
case float64:
	ltbl.RawSetString(key, lua.LNumber(val.(float64)))
case int64:
	ltbl.RawSetString(key, lua.LNumber(val.(int64)))
// ...
// after
switch valTyped := val.(type) {
case float64:
	ltbl.RawSetString(key, lua.LNumber(valTyped))
case int64:
	ltbl.RawSetString(key, lua.LNumber(valTyped))
// ...
@adatzer adatzer added the cleanup Maintenance, cleaning up codebase or repo label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Maintenance, cleaning up codebase or repo
Projects
None yet
Development

No branches or pull requests

1 participant