루아에서 간단한 웹 브라우저를 만들고 싶습니다. 다음 스크립트가 있습니다. 하지만 그 컴파일 및 제공 오류 : 글로벌 'concommand'(없음 값) 인덱스 시도 아무도 내 스크립트에 뭐가 잘못 말할 수 있습니까?루아 오류 : 전역 'concommand'색인 생성 시도 (제로 값)
-- Simple Web Browser by Drunkie
if SERVER then AddCSLuaFile("web_browser.lua") return end
concommand.Add("OpenWebBrowser", function()
local homepage = "http://www.google.com"
local frame = vgui.Create("DFrame")
frame:SetSize(ScrW()*0.8, ScrH()*0.8)
frame:SetTitle("")
frame:SetDraggable(false)
frame:Center()
frame:MakePopup()
frame.Paint = function()
surface.SetDrawColor(0, 0, 0, 150)
surface.DrawRect(0, 0, frame:GetWide(), frame:GetTall())
end
local lbl_loading = vgui.Create("DLabel", frame)
lbl_loading:SetText("Loading . . .")
surface.CreateFont("coolvetica", 64, 400, true, false, "LoadFont")
lbl_loading:SetFont("LoadFont")
lbl_loading:SetColor(Color(255, 255, 255))
lbl_loading:SizeToContents()
lbl_loading:Center()
local html_pos = { 12, 48 }
local html_size = { frame:GetWide()-html_pos[1]*2, frame:GetTall()-html_pos[2]-html_pos[1] }
local html_frame = vgui.Create("HTML", frame)
html_frame:SetPos(html_pos[1], html_pos[2])
html_frame:SetSize(html_size[1], html_size[2])
html_frame:OpenURL(homepage)
local lbl_goto = vgui.Create("DLabel", frame)
lbl_goto:SetText("Goto:")
surface.CreateFont("coolvetica", 24, 400, true, false, "GotoFont")
lbl_goto:SetFont("GotoFont")
lbl_goto:SetColor(Color(255, 255, 255))
lbl_goto:SetPos(12, 16)
lbl_goto:SizeToContents()
local txt_goto = vgui.Create("DTextEntry", frame)
txt_goto:SetSize(frame:GetWide()-96, 24)
txt_goto:SetPos(64, 14)
txt_goto:SetText(homepage)
txt_goto.OnEnter = function()
local site = string.lower(txt_goto:GetValue())
-- if string.Left(site, 7) != "http://" then
-- site = "http://" .. site
-- txt_goto:SetText(site)
-- end
html_frame:OpenURL(site)
end
end)
'concommand'는 존재하지 않는 객체입니다. 정의 된 위치는 어디입니까? – Aesthete
루아의 미리 정의 된 객체가 아닙니까? 나는 루아에서 초보자이며 여기에서이 코드를 얻었습니다. http://www.wiremod.com/forum/wiremod-addons-coding/21477-simple-web-browser.html – foobar
도와 주시겠습니까? – foobar