RE:

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE:

Nick Trout

> This code for "cgi.lua" gives me the error: unexpected symbol near '%'
> -----------------
> local I = {}
> function I.from_hex(str)
> 	local result = 0
> 	while(str ~= "") do
> 		local digit = %I.to_d(strsub(str,1,1))
> 		result = result * 16 + digit
> 		str = strsub(str,2)
> 	end
> 	return result
> end
> --------------
> Lua 5.0 on Linux Slackware 9.0
> 
> Any idea?

IIRC I think that's notation for retrieving an upvalue from Lua pre
version 5.0. I think you just need to delete the % and lexical scoping
will do the rest.

Nick