[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Haxe Lua : compile Lua/LuaJIT script from Haxe 3.3
- From: "Soni L." <fakedme@...>
- Date: Tue, 31 May 2016 14:26:21 -0300
On 31/05/16 02:00 PM, Justin Donaldson wrote:
With a little help from C, it's possible to create a very efficient
coroutine-based nil-safe array. Just need a function exchange(index,
value, ...) -> ... (that's a varargs and a varret, respectively), which
changes the value in `...` at index `index` with `value` and returns the
result. Everything else can be done from Lua. It works better as a
On Tue, May 31, 2016 at 10:19 AM, Javier Guerra Giraldez
<firstname.lastname@example.org <mailto:email@example.com>> wrote:
On 31 May 2016 at 05:42, Justin Donaldson <firstname.lastname@example.org
> it needs to track its length in order to accommodate nil values
The usual approach to store nil values in a table is to use your own
'pseudo nil' value.
Consider creating an array [1,2,3], and then setting the index 100 to
4. The indexes 4-99 will still be nil. The length of that array
reported by maxn/# would still be indeterminate. How do I resolve that?
Length operation is select('#', ...), push is `val, ...` and pop is
`select(2, ...)`. See http://sprunge.us/CGCT
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.