mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Error when given a form
This commit is contained in:
parent
c224548781
commit
41fa546a17
2 changed files with 9 additions and 0 deletions
|
@ -1034,6 +1034,11 @@ static int str_format(lua_State* L)
|
|||
}
|
||||
case '*':
|
||||
{
|
||||
if (formatItemSize != 1)
|
||||
{
|
||||
luaL_error(L, "'%%*' does not take a form");
|
||||
}
|
||||
|
||||
size_t length;
|
||||
const char* string = luaL_tolstring(L, arg, &length);
|
||||
|
||||
|
|
|
@ -146,6 +146,10 @@ end) == false)
|
|||
assert(string.format("%*", "a\0b\0c") == "a\0b\0c")
|
||||
assert(string.format("%*", string.rep("doge", 3000)) == string.rep("doge", 3000))
|
||||
|
||||
assert(pcall(function()
|
||||
string.format("%#*", "bad form")
|
||||
end) == false)
|
||||
|
||||
assert(loadstring("return 1\n--comentário sem EOL no final")() == 1)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue