A literal including \0 and a expression:
-- SLua, Beta Grid
print(#`test\0ing{1}`) -- > 4
Works well in Luau:
-- Luau, Roblox Studio
print(#`test\0ing{1}`) -- > 9
It could be that Luau is already solving it, if it uses this code:
SLua:
|
if (formatString.empty()) |
|
formatStringIndex = bytecode.addConstantString({"", 0}); |
|
else |
|
formatStringIndex = bytecode.addConstantString(sref(names.getOrAdd(formatString.c_str(), formatString.size()))); |
Luau:
https://github.com/luau-lang/luau/blob/40d4815888f63362a6cb79b3e74c4aafa0b2cbf4/Compiler/src/Compiler.cpp#L1991-L2004
A literal including \0 and a expression:
Works well in Luau:
It could be that Luau is already solving it, if it uses this code:
SLua:
slua/Compiler/src/Compiler.cpp
Lines 1962 to 1965 in fed1a35
Luau:
https://github.com/luau-lang/luau/blob/40d4815888f63362a6cb79b3e74c4aafa0b2cbf4/Compiler/src/Compiler.cpp#L1991-L2004