lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Very nice. It works indeed.

And it seems that the chunkname 'must' be prefixed by '=' char.
Using simply 'a.lua' shows:
testdofile.lua:1: [string "a.lua"]:4:



On Fri, Jul 2, 2010 at 3:19 PM, Romulo <romuloab@gmail.com> wrote:
> On Fri, Jul 2, 2010 at 10:14 AM, Valerio Schiavoni
> <valerio.schiavoni@gmail.com> wrote:
>> i've tried this code, introducing an error in the code:
>>
>> loadstring( [=====[
>> foo = bar
>> print'ok'
>> print
>> ]=====], 'a.lua' )()
>>
>> I was execting a stacktrace like:
>> lua: a.lua:3: '=' expected near ''
>
> Sorry, it should be:
>
> assert( loadstring( [=====[
> foo = bar
> print'ok'
> print
> ]=====], '=a.lua' ))()
>
>
> $ lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> assert( loadstring( [=====[
>>> foo = bar
>>> print'ok'
>>> print
>>> ]=====], '=a.lua' ))()
> stdin:1: a.lua:4: '=' expected near '<eof>'
> stack traceback:
>        [C]: in function 'assert'
>        stdin:1: in main chunk
>        [C]: ?
>
>
> --rb
>