lua-users home
lua-l archive

Search lua-l

This index contains 143,615 documents and 1,774,615 keywords. Last update on 2023-03-09 .

Query: [How to search]

Display: Description: Sort by:

Results:

References: [ attempt: 3298 ] [ to (Too many documents hit. Ignored) ] [ index: 6969 ] [ a (Too many documents hit. Ignored) ] [ nil: 12751 ]

Total 504 documents matching your query.

61. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 431)
Author: steve donovan <steve.j.donovan@...>
Date: Fri, 18 Feb 2011 13:56:40 +0200
You need quotes around the w; w is probably nil, so it tries to open for reading (the default) steve d.
62. Re: [5.1.4] "attempt to index global 'data' (a nil value) (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Sun, 24 Jul 2011 22:56:02 +0200
On Sun, 24 Jul 2011 21:23:56 +0100, Peter Cawley <lua@corsix.org> wrote: Found it: There were cases where the URL was followed by other attributes: == <a href="/places/0.php">dummy<a href="/places/1.
63. Re: [5.1.4] "attempt to index global 'data' (a nil value) (score: 427)
Author: Peter Cawley <lua@...>
Date: Sun, 24 Jul 2011 21:23:56 +0100
Works for me: line=[[<a href="/places/1.php">1</a> <a href="/places/2.php">2</a>]] for w in string.gmatch(line, '<a href="/places/.-%.php">') do print(w) end Gives: <a href="/places/1.php"> <a href="
64. Re: [5.1.4] "attempt to index global 'data' (a nil value) (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Sun, 24 Jul 2011 22:20:17 +0200
On Sun, 24 Jul 2011 14:14:03 +0100, Peter Cawley <lua@corsix.org> wrote: Thanks for the tip. Apparently, Lua doesn't include a regex library, and I can't figure out how to make its string library non
65. Re: [5.1.4] "attempt to index global 'data' (a nil value) (score: 427)
Author: Peter Cawley <lua@...>
Date: Sun, 24 Jul 2011 14:14:03 +0100
Lua's string library doesn't use any kind of regex. I would guess that the string library's .- is equivalent to the regex .+? construction, and that %. is equivalent to \. (the latter, expressed in a
66. Re: [5.1.4] "attempt to index global 'data' (a nil value) (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Sun, 24 Jul 2011 15:01:17 +0200
Found it: blackslashes must be doubled: == data = io.open("C:\\places.txt","r") == However, Lua doesn't print anything, although I'm sure the regex is correct (tested in UltraEdit): == for token in s
67. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Sat, 19 Feb 2011 10:36:40 +0100
Thanks Roberto.
68. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Alex Bradbury <asb@...>
Date: Fri, 18 Feb 2011 20:04:44 +0000
See also http://lua-users.org/wiki/DetectingUndefinedVariables Alex
69. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Roberto Ierusalimschy <roberto@...>
Date: Fri, 18 Feb 2011 15:01:52 -0200
Better yet: local file = assert(io.open ('/var/tmp/myfile.txt',"w")) -- Roberto
70. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Fri, 18 Feb 2011 14:27:12 +0100
Right, sorry about that. I don't have access to the calling C program. I just mentionned this because a compile/runtime error in Lua would just return a non-zero error with no information about what
71. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Luiz Henrique de Figueiredo <lhf@...>
Date: Fri, 18 Feb 2011 11:20:28 -0200
You did mention C... Anyway, use loadfile instead of dofile.
72. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Fri, 18 Feb 2011 13:29:33 +0100
Thanks, I'll give this and lua-inspect a try. According to Google, those are C functions used to call a Lua file. I only run scripts with the Lua interpreter, but thanks for the tip.
73. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Luiz Henrique de Figueiredo <lhf@...>
Date: Fri, 18 Feb 2011 10:26:25 -0200
luac -p But that [w vs. "w"] issue is not a syntax error. Use luaL_loadfile+lua_pcall instead of luaL_dofile.
74. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Alexander Gladysh <agladysh@...>
Date: Fri, 18 Feb 2011 15:21:12 +0300
Try luac -p. Also see lua-inspect: http://lua-users.org/wiki/LuaInspect HTH, Alexander.
75. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Gilles Ganault <gilles.ganault@...>
Date: Fri, 18 Feb 2011 13:18:13 +0100
Thanks guys, it works now. I didn't notice that mode had to be quoted. BTW, is there a tool that can parse a Lua script to spot syntax errors? As this script is called by a C program, when there's a
76. Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"? (score: 427)
Author: Luiz Henrique de Figueiredo <lhf@...>
Date: Fri, 18 Feb 2011 09:56:57 -0200
The file does not exist and you have opened if for reading. Try local file = io.open ('/var/tmp/myfile.txt',"w")
77. Re: [proposal] Using nil/NaN as table index (score: 334)
Author: "Thiago L." <fakedme@...>
Date: Tue, 08 Apr 2014 15:14:57 -0300
I think it is inconsistent that an attempt to use nil or NaN as a key when setting a field is an error: ...yet when getting a field it silently produces nil: The same happens when using rawset/rawget
78. [proposal] Using nil/NaN as table index (score: 327)
Author: Peter Melnichenko <petjamelnik@...>
Date: Tue, 08 Apr 2014 20:57:26 +0400
Hello, I think it is inconsistent that an attempt to use nil or NaN as a key when setting a field is an error: ...yet when getting a field it silently produces nil: The same happens when using rawset
79. Re: Lookup nil table index (score: 288)
Author: Michael Wolf <miwo@...>
Date: Thu, 30 Nov 2006 20:25:39 +0100
Hello, I'm working on code with quite deep tables. When referring to an element in the table, I use the table keys joined by dots, eg: a = thing.foo.bar.this.that When one of the indicated elements d
80. Re: Any pitfalls to the nil index idiom? (score: 281)
Author: Javier Guerra Giraldez <javier@...>
Date: Tue, 19 Jul 2016 13:28:56 +0100
it can after setting the metatable stdin:1: attempt to index global 'a' (a nil value) stack traceback: stdin:1: in main chunk [C]: at 0x00404750 nil -- Javier

Search by Namazu v2.0.21