Le 25 déc. 12 à 23:24, Hans Hagen a écrit :
On 12/25/2012 9:36 AM, Roland Thiers wrote:
- when one create a table doing this : userdata=userdata or {}, is it only to be sure that "userdata" is not actually a variable which exists (with a non nil value) ? Less safely we could write : userdata={} ?
There can already be stuff in userdata that you don't want to loose. OK.
- arguments for the user.data.table function are given as strings : " #1" and changed in numbers in the body of the function. I noticed that it was possible to give numbers directly. is there always better to do like this ? (enter strings et use tonumber)
Depends on if you want to catch errors. Forgetting an argument (or an empty one) when a number is expected results in ,, which triggers a Lua error, while with ,"", you can intercept the empty string and default.
Hans
OK. Thanks ! Roland
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------