Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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



Similar Threads
Thread Thread Starter Forum Replies Last Post
error messages strt_prg Struts 1 November 13th, 2006 07: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 06:03 AM
Error messages ldoodle Access ASP 12 June 6th, 2005 01:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.