Page MenuHomePhabricator

Strings defined as long comments give a Lua modules syntax error
Closed, InvalidPublic

Description

These 2 codes give a syntax error when the parser works on "local x":

local bug1 = --[=[
abc xyz
--]=]
local x = "bug1"

local bug2 = --[=[
[[link]]
--]=]
local x = "bug2"

Even tried in the first lines of the Lua module.
Since which Mediawiki version? Unknown. Rical never used that before.

Event Timeline

Anomie subscribed.

Comments and strings are not the same thing. The code you're entering is equivalent to (without comments)

local bug1 = 
local x = "bug1"

local bug2 = 
local x = "bug2"

You probably want to use long bracket string syntax, not long bracket comment syntax.

local bug1 = [=[
abc xyz
]=]
local x = "bug1"

local bug2 = [=[
[[link]]
]=]
local x = "bug2"

Sorry and thanks! My brain don't seen my mistake.