lua-users home
lua-l archive

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


The lua 5.0.2 returns an error when using literal
strings in code like:

--first example
print([[________]]])
--second example
print([[________]]________]])

It doesn't allow a [[]] literal string to end with ]]]
(at least one ] character next to the two final
delimiter characters ]] -> this is the first example).
Also it doesn't allow the a pair of ] characters
between the string's delimiters (this is the second
code example). The _ characters are just for filling
(it's optional). Is this a language limitation or an
interpreter bug? The lua interpreter returns some
error messages like this one:
`)' expected near `]'

*****************

What is wrong with the next code?
setfenv(0, { some_global_var = 0}
print(_G.some_global_var)

Or this one?
t = { some_global_var = 0}
setfenv(0, t)
print(_G.some_global_var)

Both return message errors like this one:
lua: attempt to call a nil value
stack traceback:
        [C]: in function `print'
        x.lua:2: in main chunk
        [C]: ?

I just want to add some global variable to the global enviroment.


		
__________________________________________ 
Yahoo! DSL ? Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com