Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK Beginning Lua Programming ISBN: 978-0-470-06917-2
This is the forum to discuss the Wrox book Beginning Lua Programming by Kurt Jung, Aaron Brown; ISBN: 9780470069172
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK Beginning Lua Programming ISBN: 978-0-470-06917-2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 2nd, 2007, 03:17 PM
Registered User
 
Join Date: Feb 2007
Location: Lake Jackson, TX, .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lua error messages

Is there someplace that one can find a listing of Lua message error definitions?

Submariners are a bunch of intelligent misfits that somehow seem to get along, understand each other and work well together
__________________
Submariners are a bunch of intelligent misfits that somehow seem to get along, understand each other and work well together
Reply With Quote
  #2 (permalink)  
Old June 3rd, 2007, 01:21 PM
Wrox Author
 
Join Date: Apr 2006
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

> Is there someplace that one can find a listing of Lua message error definitions?

A list like this would be a good addition to the reference manual. You can generate a list that picks up the error messages from the source code with the following script.

  local function file_contents_get(file_str)
    local str
    local hnd = io.open(file_str, "r")
    if hnd then
      str = hnd:read("*all")
      hnd:close()
    end
    return str
  end

  local tbl = {}
  for j, file_str in ipairs(arg) do
    local str = file_contents_get(file_str)
    if str then
      str = string.gsub(str, "%s+", " ")
      str = string.gsub(str, "%c+", "")
      str = string.gsub(str, "luaL_error", "\001")
      str = string.gsub(str, "luaL_argerror", "\001")
      str = string.gsub(str, "luaX_syntaxerror",
        "\001")
      str = string.gsub(str, "luaX_lexerror", "\001")
      for err_str in string.gmatch(str,
        '\001%(.-%,%s*(.-)%)%;') do
        if string.match(err_str, '"') then
          tbl[#tbl + 1] = err_str
        end
      end
    end
  end
  table.sort(tbl)
  for j, str in ipairs(tbl) do
    print(str)
  end

This script assumes that the names of the Lua C source files will be passed in as arguments.

--
Kurt

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
error messages strt_prg Struts 1 November 13th, 2006 06:05 AM
error messages timbal25 Classic ASP Databases 0 August 1st, 2006 02:56 PM
customer Error Messages testsubject Visual Studio 2005 5 March 2nd, 2006 05:03 AM
Error messages ldoodle Access ASP 12 June 6th, 2005 01:05 PM



All times are GMT -4. The time now is 03:03 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.