PDA

View Full Version : need lua code help please



yonu
September 30th, 2013, 01:41 PM
I am trying to get a new custom device working working in the lua script but I keep receiving this error I am hoping I have just missed something

DeviceManager/Devices.lua:62: Already have a device called Status
stack traceback:
[C]: in function `assert'
DeviceManager/Devices.lua:62: in function `AddDeviceClass'
DeviceManager/Devices/lighting.lua:352: in function `init'
compat-5.1.lua:195: in function `require'
DeviceManager/Devices/custom.lua:4: in function `init'
compat-5.1.lua:195: in function `require'
[string "udp-server.gml:\test\test DM"]:2: in main chunk


here is my code in the lua file

--[[

system status Device Class

Uses the button control that turns off it self.

--]]


local Sysstat = Switch:New ( {

Type = 'Switch\\Sysstat',

AddControls = function (self)

local StatusControl = DeviceManager.Controls.Classes.Label: New ( {Name = "CPU temp",Device = self} )

self:AddControl (StatusControl)


local control = DeviceManager.Controls.Classes.PushButton: New ( {ID = 'Switch',Name = "Restart",Device = self, Command = self.Command} )

self:AddControl (control)
control:UpdateValue("Idle")


end,

} )


Here is the code I am calling it from


require 'DeviceManager.Devices.custom'



MyPlayer = BasicDeviceContainer:Create ( {
ID = 'teststat',
DMClass = DeviceManager.Devices.Classes.Sysstat,
Name = 'PVR_Status',
Location = 'Computers',
Description = 'PVR_Status',
} )

yonu
October 3rd, 2013, 12:59 PM
Got the issue fixed turns out that it was case sensitive as soon as a changed
require 'DeviceManager.Devices.custom'

to

require 'DeviceManager.Devices.Custom'

it worked