我试图根据性别选择来更改姓名(默认情况下是男性)。但是我做不到。我一直试图做一整天,但仍然无法正常工作。 确实有效,性别正确地从男性改变为女性,但是当我尝试将其改变为(从女性改变为男性)时,我得到一个错误:
'Open connection
ConnectionString = "DSN=" & strDSN &";Uid=" & strUID & ";Pwd=" & strPWD & ";"
objConnection.Open(ConnectionString)
'--- assuming all the variables are initialized
strQuery =
"DECLARE p_bool BOOLEAN; BEGIN p_bool:= x_found_in_y('employee', 'employee_table'); END;"
Set objResults = objConnection.Execute strQuery
代码如下:
[ERROR] *path*/cl_new_character.lua:1055: attempt to perform arithmetic on upvalue 'defMaleInfos' (a table value)
1. DoClick - *path*/cl_new_character.lua:1055
2. unknown - lua/vgui/dlabel.lua:232
答案 0 :(得分:0)
能否让我们知道 1055 是哪一行?因为我唯一能看到的是正在编辑' infos '表的四个成员,然后全部替换为一个性别信息的默认值。
infos.name = table.Random(listWName)
infos.surname = table.Random(listWSurname)
infos = defMaleInfos
-------------------------------------------
infos.name = table.Random(listWName)
infos.surname = table.Random(listWSurname)
infos = defFemaleInfos
应该是:
infos = defMaleInfos
infos.name = table.Random(listWName)
infos.surname = table.Random(listWSurname)
-------------------------------------------
infos = defFemaleInfos
infos.name = table.Random(listWName)
infos.surname = table.Random(listWSurname)
编辑:您还需要查看其他内容( 989 - 1022 行),因为在这些行中您会用到 C注释代码的方式。因此,您应该分别用-[[[和-]] 替换那些 / * * / :
--[[local TextEntry = vgui.Create( "DTextEntry", DPanel ) -- create the form as a child of frame
TextEntry:SetPos( w/2-100, 30 + 40 )
TextEntry:SetSize( 200, 30 )
TextEntry:SetText( infos.name )
TextEntry.OnTextChanged = function( self )
txt = self:GetValue()
local amt = string.len(txt)
if amt > 15 then
self.OldText = self.OldText or infos.name
self:SetText(self.OldText)
self:SetValue(self.OldText)
else
self.OldText = txt
end
infos.name = TextEntry:GetValue()
end
local TextEntry2 = vgui.Create( "DTextEntry", DPanel ) -- create the form as a child of frame
TextEntry2:SetPos( w/2-100, 30 + 40 * 2 )
TextEntry2:SetSize( 200, 30 )
TextEntry2:SetText( infos.surname )
TextEntry2.OnTextChanged = function( self )
txt = self:GetValue()
local amt = string.len(txt)
if amt > 15 then
self.OldText = self.OldText or infos.surname
self:SetText(self.OldText)
self:SetValue(self.OldText)
else
self.OldText = txt
end
infos.surname = TextEntry2:GetValue()
end
--]]