|
本帖最后由 feixiong 于 2012-4-22 01:07 PM 编辑
- qtlsnew={
- new=function()
- local _qtlsnew={}
- setmetatable(_qtlsnew,{__index=qtlsnew})
- return _qtlsnew
- end,
- }
- qtlsnew.biaoju={}
- Jobinfo={
- new=function()
- local job={}
- setmetatable(job,{__index=Jobinfo})
- job.job_table={}
- return job
- end,
- interval=5,
- job_table={},
- }
- -------------------------------------------------------------------------
- function Jobinfo:register()
- local _job={}
- ----------------------------------------------------
- ----------------------------------------------------
- ----------------------------------------------------
- _job={}
- _job.id="zaochen"
- _job.name="早晨敲钟"
- _job.jobnpcid="sha mi"
- _job.jobnpcname="沙弥"
- _job.startroomno=844 --沙弥处要任务 开始的房间号
- _job.renwuroomno=850----早晨去工作的固定地点
- _job.renwunpcid="nie"----工作地点申请开工的npc
- table.insert(self.job_table,_job)
- ----------------------------------------------------
- ----------------------------------------------------
- _job={}
- _job.id="shangwu"
- _job.name="晌午帮厨"
- _job.jobnpcid="sha mi"
- _job.jobnpcname="沙弥"
- _job.startroomno=844 --沙弥处要任务 开始的房间号
- _job.renwuroomno=847----早晨去工作的固定地点
- _job.renwunpcid="nie"----工作地点申请开工的npc
- table.insert(self.job_table,_job)
- end
- Job_Register=function()
- if Curjob_Info=="" or Curjob_Info==nil then
- Curjob_Info="fuzhou"
- end
- local j=Jobinfo.new()
- j:use(Curjob_Info)
- qtlsnew.biaoju={
- jobnpcid=j.jobnpcid,
- jobnpcname=j.jobnpcname,
- startroomno=j.startroomno,
- renwuroomno=j.renwuroomno,
- renwunpcid=j.renwunpcid,
- }
- end
- -------------------------------------------------------------------------
- function Jobinfo:use(Jobinfo_id)
- self:register()
- for _,a in ipairs(self.job_table) do
- if a.id==Jobinfo_id then
- self.name=a.name
- self.jobnpcid=a.jobnpcid
- self.jobnpcname=a.jobnpcname
- self.startroomno=a.startroomno
- self.renwuroomno=a.renwuroomno
- self.renwunpcid=a.renwunpcid
- break
- end
- end
- end
- Curjob_Info="zaochen"
- print(qtlsnew.biaoju.renwuroomno)
复制代码
---------- run_lua ----------
nil
输出完成 (耗时: 0 秒)
为什么输出结果是nil?我找了好半天也没找到
群里问了emyt好多次了,不好意思问了,请
有空的高手指导我以下,谢谢!
北大侠客行MUD,中国最好的MUD |
|