[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: patch: local a,b from t
- From: Peter Shook <peter.shook.engineer@...>
- Date: Tue, 6 Sep 2005 23:45:47 -0400
Hello,
if you would rather type
local a, b from some_table_expression
instead of
local t = some_table_expression
local a, b = t.a, t.b
then this patch is for you!
http://lua-users.org/files/wiki_insecure/power_patches/5.1-alpha/lua-5.1-alpha-from.patch
$ lua
Lua 5.1 (alpha) Copyright (C) 1994-2005 Lua.org, PUC-Rio
>
> write from io
> format from string
>
> function printf(...) write(format(...)) end
>
> printf("I should have written this patch %d years ago\n", 2)
I should have written this patch 2 years ago
>
> t = { a=1, b=2 }
>
> a, b from t
>
> print(a, b)
1 2
>
Cheers,
- Peter Shook