简体   繁体   English

LUA错误:尝试调用方法“(nil值)

[英]LUA error : attempt to call method '' (a nil value)

I have some troubles with a simple code that I've made : 我编写的简单代码有些麻烦:

SWEP.PrintName          = "Gestionnaire d'alarmes Administrateur"           
SWEP.Author         = "Frass"
SWEP.Instructions       = "Clic Gauche : Ouvrir le gestionnaire"

SWEP.Spawnable = true
SWEP.AdminOnly = true

SWEP.Primary.ClipSize       = -1
SWEP.Primary.DefaultClip    = -1
SWEP.Primary.Automatic      = false
SWEP.Primary.Ammo       = "none"

SWEP.Secondary.ClipSize     = -1
SWEP.Secondary.DefaultClip  = -1
SWEP.Secondary.Automatic    = true
SWEP.Secondary.Ammo     = "none"

SWEP.Weight         = 5
SWEP.AutoSwitchTo       = false
SWEP.AutoSwitchFrom     = false

SWEP.Slot           = 1
SWEP.SlotPos            = 2
SWEP.DrawAmmo           = false
SWEP.DrawCrosshair      = true


SWEP.ViewModel          = "models/weapons/v_pistol.mdl"
SWEP.WorldModel         = "models/weapons/w_pistol.mdl"

local ShootSound = Sound( "buttons/button14.wav" )

function SWEP:PrimaryAttack()

    self:TabletMenu()

end


function TabletMenu() (reduced, there's a lot of code inside)

When I try to use my SWEP in GMOD, the console give me this error : 当我尝试在GMOD中使用SWEP时,控制台给我这个错误:

[ERROR] lua/weapons/alarmtabletld.lua:44: attempt to call method 'TabletMenu' (a nil value)
  1. unknown - lua/weapons/alarmtabletld.lua:44

I really don't understand what is doing this error... Some help could be really nice ! 我真的不明白这是怎么回事...有些帮助可能真的很好!

You are calling a TabletMenu function that doesnt exist as part of the SWEP table. 您正在调用不作为SWEP表一部分存在的TabletMenu函数。 Is it defined somewhere else perhaps? 它是否在其他地方定义?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM