HaxeFoundation / HaxeFoundation/haxe

Lua 5.3 implements bit32 as a native and utf8 as just utf8 not lua-utf8

Open
#9,412 1 comment 1 reaction 1 assignee Claimed by @jdonaldson View on GitHub
platform-lua
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Similar to:
https://github.com/HaxeFoundation/haxe/issues/5954
Lua 5.3 now includes the bit32 operators as a key word and changes lua-utf8 to utf8 (and the require will fail.)

A change of:
```
53c53
< __lua_lib_luautf8_Utf8 = _G.require("lua-utf8")
---
> __lua_lib_luautf8_Utf8 = _G.require("utf8")
785c785
< local _hx_bit_raw = _G.require('bit32')
---
> local _hx_bit_raw = bit32
```
fixes it

Probably room to insert conditionals based on version:
https://stackoverflow.com/questions/16257259/in-lua-is-there-a-function-that-will-tell-me-what-current-version-im-running, or walk through attempts to find what you want.
```
local _hx_bit_raw
if 32bit then
_hx_bit_raw = 32bit
else
_hx_bit_raw = _G.require('bit32')
```
and
```
local success, module = pcall(require, 'utf8')
if not success then
success, module = pcall(require, 'lua-utf8')
end
__lua_lib_luautf8_Utf8 = module
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.