lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jan 13, 2010, at 1:24 AM, Petite Abeille wrote:

> Hmmm... nothing to do with the script... luac -p -l seems to seg fault on some of my code.

% luac -v
Lua 5.2.0 (work1)  Copyright (C) 1994-2008 Lua.org, PUC-Rio

--8<--
local HTTP = require( 'HTTP' )
local TCPServer = require( 'TCPServer' )
local aServer = TCPServer( '127.0.0.1', 1080 )

HTTP[ '/hello(%a*)' ] = function( aName ) return 'Hello ' .. ( aName or 'world' ) end 
HTTPResponse.filter[ #HTTPResponse.filter + 1 ] = function( aRequest, aResponse ) aResponse.header[ 'connection' ] = 'close' end

print( aServer )

aServer( HTTP )
-->8--

% luac -l TestServer.lua


main <TestServer.lua:0,0> (27 instructions, 108 bytes at 0x100100ee0)
0+ params, 6 slots, 0 upvalues, 3 locals, 10 constants, 2 functions
	1	[1]	GETGLOBAL	0 -2	; HTTP
	2	[1]	LOADK    	1 -3	; "TCPServer"
	3	[1]	CALL     	0 2 2
	4	[2]	GETGLOBAL	1 -2	; HTTP
	5	[2]	LOADK    	2 -4	; "127.0.0.1"
	6	[2]	CALL     	1 2 2
	7	[3]	MOVE     	2 1
	8	[3]	LOADK    	3 -5	; 1080
	9	[3]	LOADK    	4 -6	; "/hello(%a*)"
	10	[3]	CALL     	2 3 2
	11	[5]	CLOSURE  	3 0	; 0x1001011b0
	12	[5]	SETTABLE 	0 -6 3	; "/hello(%a*)" -
	13	[6]	GETGLOBAL	3 -8	; filter
	14	[6]	GETTABLE 	3 3 -8	; "filter"
	15	[6]	GETGLOBAL	4 -8	; filter
	16	[6]	GETTABLE 	4 4 -8	; "filter"
	17	[6]	LEN      	4 4
	18	[6]	ADD      	4 4 -9	; - 1
	19	[6]	CLOSURE  	5 1	; 0x100101310
	20	[6]	SETTABLE 	3 4 5
Segmentation fault