[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: load functions arguments
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 6 Nov 2014 14:23:31 +0200
2014-11-05 19:09 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
> local fun, err = (the_code_chunk_as_string, 'b', _ENV)
> -->bad argument #3 to 'load' (string expected, got table)
> local fun, err = (the_code_chunk_as_string, nil, 'b', _ENV)
> -->function, nil
>
> Due to my last mistake, I was able to figure this one out.
Sadly, no.
> However, it's still weird a bit weird and only after thinking about
> it (a lot), do I see why: _ENV might be a string,
If _ENV is not a table, it is an error.
`load` is clean. Look at the nested brackets for its arguments.
ld [, source [, mode [, env]]]
That means one of:
ld
ld,source
ld,source,mode
ld,source,mode,env
Unlike debug.traceback:
[thread,] [message [, level]]
which means one of:
<nothing>
message
message,level
thread
thread,message
thread,message,level