Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Mon, 24 Oct 2011 04:07:58 -0500 Date: Mon, 24 Oct 2011 10:07:24 +0100 From: Gavin Wraith Newsgroups: comp.sys.acorn.programmer Subject: Re: BBC BASIC, EVAL and PROC Message-ID: References: Organization: Home User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.16) NewsHound/v1.50-32 Lines: 33 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-gnhWo5fd10SlfTry19hN7UptE2fMVR8jL6+5dOtIzM5do4ls9IlxjAHai9sB78FEOwU0b8ZxeNovN5N!LE/N6XZmICoKOQtB+ivBS6e8nYv0sA0WdMUKWZo24/AaBBuqPwmGDDMYc26A18Cd4I4YEkJGlErr!HaRQ X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2066 Xref: x330-a1.tempe.blueboxinc.net comp.sys.acorn.programmer:914 In message Steve Fryatt wrote: > You can't call procedures that don't exist, Excuse the peripheral relevance. RiscLua does not have a CASE statement but you can fake one with CASE = \(list_of_procs,defaultproc) => \(code,...) local action = list_of_procs[code] if action then => action(...) else => defaultproc(...) end end end which copes nicely with procedures with indeterminate numbers of parameters and undefined procedures. Thus, for example wimp_case = CASE (event_handlers, do_nothing) repeat reason_code = sys ("Wimp_Poll",mask,message_block) result = wimp_case (reason_code,message_block, user_parameters) until exit(result) shows how the CASE structure can be lifted out of the polling loop. Incidentally, the "..." is the Lua syntax for an indeterminate number of parameters, not metasyntax. -- Gavin Wraith (gavin@wra1th.plus.com) Home page: http://www.wra1th.plus.com/