[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Exposure of nil to end-users
- From: Eva Schmidt <es@...>
- Date: Thu, 05 Feb 2009 11:28:25 +0100
in any case you have to check if (value == nil).
Hm, what you would actually need is something like overloading the .. operator.
I don't know if that is possible.
But maybe you could define your own concatentaion function, that lives within
your environments metatable and call the .. only if the string value is ~= nil,
otherwise concatenates to an empty string ""?
So you could hide the checking but avoid problem by concatenating a string to
nil. After all, using .. by the user should be prohibited then somehow ...
Ok - just thoughts ... Maybe somebody as another idea :-)
Ben Harper wrote:
I am using Lua as a language that allows end-users to manipulate
My problem is that I'm not sure how to expose NULL values to the user.
In this example, value = nil
User Types: value .. "abc"
User Expects: 'abc'
User Gets: Error: attempt to concatenate a nil value
Has anybody had a similar problem, and how have you dealt with it?