北大侠客行MUD论坛

 找回密码
 注册
搜索
热搜: 新手 wiki 升级
查看: 4532|回复: 2

mush使用lua机器人报错,那位帮我看下。谢谢。。

[复制链接]
发表于 2011-1-30 20:48:01 | 显示全部楼层 |阅读模式
用的lua红豆版机器人。mush版本4.71.win版的libiconv-1.9.2-1.exe的装了。odbc设置了。系统是win7 64位。

ask hongdou about test后报这个错误。。

-------------------------------------------------
Run-time error
World: 红豆机器人
Immediate execution
[string "Script file"]:28:
stack traceback:
        [C]: in function 'assert'
        [string "Script file"]:28: in function 'getanswer'
        [string "Trigger: "]:1: in main chunk
Error context in script:
  24 : -- 创建环境对象
  25 : env = assert (luasql.odbc())
  26 :
  27 : -- 连接数据库
  28*: con = assert (env:connect ("hongdou",     -- DSN 名称
  29 :                            "",        -- 用户名
  30 :                            ""))  -- 密码
  31 :
  32 : sqlstr = "SELECT [timu],[answer] FROM [timu] WHERE [timu] = '"..timu_txt.."'"----先检索题目
---------------------------------------------

全局设置里的lua代码:
----------------------------------------------
trust_all_worlds = true    -- change to true to trust all the worlds
trust_all_plugins = true   -- change to true to trust all the plugins
warn_if_not_trusted = false -- change to true to show warnings
--[[
-- Lua initialization (sandbox) --> please read comments carefully.
-- Default initialization supplied with version 3.80.
Use this to create a "sandbox" for safe execution of non-trusted scripts.
If you only run your own scripts or plugins then you may not need this.
The code in this area is executed after each Lua script space is created
but before any of your scripts are done. This can be used to initialise things
(eg. load DLLs, load files, set up variables) or to disable things as shown below.
By setting a function name to nil you effectively make it unavailable.
You can remove some functions from a library rather than all of them, eg.
  os.execute = nil  -- no operating system calls
  os.remove = nil   -- no deleting files
  os.rename = nil   -- no renaming files
This script will automatically be replaced if you completely delete it from
the Global Preferences, and restart MUSHclient. To avoid this, leave a comment
in (if you don't want any further action taken).
--]]
-- Example sandbox --
function MakeSandbox ()
  local function ReportDisabled (pkg, func)
     return function ()
       error (string.format (
        "Function '%s.%s' disabled in Lua sandbox - see MUSHclient global preferences",
        pkg, func), 2)
       end -- function
  end -- ReportDisabled
--  package.loadlib = ReportDisabled  ("package", "loadlib") -- disable loadlib function
  package.loaders [3] = nil  -- disable DLL loader
  package.loaders [4] = nil  -- disable all-in-one loader
  for k, v in pairs (io) do
    if type (v) == "function" then
      io [k] = ReportDisabled ("io", k)
    end -- type is function
  end -- for
  local orig_os = os -- so we know names of disabled ones
  -- replace 'os' table with one containing only safe functions
  os = {
       date = os.date,
       time = os.time,
       setlocale = os.setlocale,
       clock = os.clock,
       difftime = os.difftime,
       }
  for k, v in pairs (orig_os) do
    if not os [k] and type (v) == "function" then
      os [k] = ReportDisabled ("os", k)
    end -- not still active
  end -- for
   if warn_if_not_trusted then
     ColourNote ("yellow", "black",
                 "Lua sandbox created, some functions disabled.")
   end -- if warn_if_not_trusted
end -- end of function MakeSandbox

-- default is to sandbox everything --
-- To trust individual worlds or plugins, add them to the lists below.
                             
-- To find your current world ID, do this: /print (GetWorldID ())
-- Plugin IDs are mentioned near the start of every plugin.
-- You can limit the behaviour to specific worlds, or specific plugins
-- by doing something like this:
do
  -- World IDs of worlds we trust - replace with your world IDs
  --    (and remove comment from start of line)
  local trusted_worlds = {
--    ["a4a1cc1801787ba88cd84f3a"] = true,  -- example world A
--    ["cdc8552d1b251e449b874b9a"] = true,  -- example world B
--    ["1ec5aac3265e472b97f0c103"] = true,  -- example world C
      }  -- end of trusted_worlds
  -- Plugin IDs of plugins we trust - add your plugins to the table
  local trusted_plugins = {
     [""] = "",            -- trust main script (ie. if no plugin running)
     ["03ca99c4e98d2a3e6d655c7d"] = "Chat",  
     ["982581e59ab42844527eec80"] = "Random_Socials",
     ["4a267cd69ba59b5ecefe42d8"] = "Installer_sumcheck",  
     ["83beba4e37b3d0e7f63cedbc"] = "Reconnecter",   
     }  -- end of trusted_plugins

  -- check worlds
  if not trust_all_worlds then               
    if not trusted_worlds [GetWorldID ()] then
       if warn_if_not_trusted  then
         ColourNote ("yellow", "black", "Untrusted world " .. WorldName () ..
                     ", ID: " .. GetWorldID ())
       end -- if warn_if_not_trusted
       MakeSandbox ()
    end -- not trusted world or plugin
  end -- not trusting all worlds
  -- check plugins - check name *and* plugin ID
  if not trust_all_plugins then
    if trusted_plugins [GetPluginID ()] ~= GetPluginName () then
       if warn_if_not_trusted  then
         ColourNote ("yellow", "black", "Untrusted plugin " .. GetPluginName () ..
                     ", ID: " .. GetPluginID ())
       end -- if warn_if_not_trusted
       MakeSandbox ()
    end -- not trusted world or plugin
  end -- if not trusting all plugins
end -- local block
-- warn if we can't load DLLs (checkbox might be unchecked)
if not package.loadlib and warn_if_not_trusted  then
   local by_this_plugin = ""
   if GetPluginID () ~= "" then
     by_this_plugin = " by this plugin"
   end -- this is a plugin
   ColourNote ("yellow", "black",
               "Loading of DLLs" .. by_this_plugin .. " is disabled.")
end -- if
---------------------------------------------------------------------

折腾了半天,一直报错。。。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2011-1-30 21:00:45 | 显示全部楼层
............终于。。。好了。。。擦。。。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2011-1-30 21:07:04 | 显示全部楼层
客户端问题以后请发到技术版
转移一下,楼主见谅
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|北大侠客行MUD ( 京ICP备16065414号-1 )

GMT+8, 2024-11-28 09:46 PM , Processed in 0.010035 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表