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

Replace allocateUTF8 with stringToNewUTF8 #80

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ emcc \
'setValue', \
'lengthBytesUTF8', \
'stringToUTF8', \
'allocateUTF8'
'stringToNewUTF8'
]" \
-s STRICT_JS=0 \
-s MODULARIZE=1 \
Expand Down
4 changes: 2 additions & 2 deletions src/luawasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface LuaEmscriptenModule extends EmscriptenModule {
setValue: typeof setValue
getValue: typeof getValue
FS: typeof FS
allocateUTF8: typeof allocateUTF8
stringToNewUTF8: typeof allocateUTF8
lengthBytesUTF8: typeof lengthBytesUTF8
stringToUTF8: typeof stringToUTF8
ENV: EnvironmentVariables
Expand Down Expand Up @@ -450,7 +450,7 @@ export default class LuaWasm {
} else {
// because it will be freed later, this can only be used on functions that lua internally copies the string
if (args[i]?.length > 1024) {
const bufferPointer = this.module.allocateUTF8(args[i] as string)
const bufferPointer = this.module.stringToNewUTF8(args[i] as string)
args[i] = bufferPointer
pointersToBeFreed.push(bufferPointer)
return 'number'
Expand Down