|
> I do not see any issue here.
> newlines are insignificant in lua. your example is the same as:
>
> print("hello")(function() print"world" end)()
>
> i.e.
> 1. call print with "hello",
> 2. call the result of that with an argument of a function
> 3. call the result of that with no arguments.
>
> As the result of print is nothing; at step 2 you attempt to call
> `nil`, and hence get the (correct) error message.
>
And if you want to call a annoy function or methods on string or other
literal (need parentheses), you use add a ; before, like this:
--
print "hello"
;(function() print "world" end)()
regards,
Xavier Wang.