Hi
I have all in script part and I suspect that this is the problem. OnPluginInstall, WindowCreate,...
See code
The client complains
I found out that when I try tprint(windowinfo) in the OnPluginInstall it is ok but outside it complains
So it doesnt know anything about table windowinfo. I use this construct in another plugin where only the OnPluginInstall is in <script> section and rest is in alias body.
I don't know why it doesn't work. I'm lost. Help please.
Thank you
I have all in script part and I suspect that this is the problem. OnPluginInstall, WindowCreate,...
See code
<script>
<![CDATA[
require "checkplugin"
require "tprint"
require "movewindow"
win = GetPluginID () .. "_ident"
font = "f"
report = {}
function OnPluginInstall ()
print("OnPluginInstall")
-- install the window movement handler, get back the window position
windowinfo = movewindow.install (win, 6) -- default to 6 (on top right)
-- make window so I can grab the font info
WindowCreate (win, 0, 0, 0, 0, 1, 0, 0)
-- add the font
WindowFont (win, font, "Lucida Console", 9)
end -- OnPluginInstall
function OnPluginSaveState ()
-- save window current location for next time
movewindow.save_state (win)
end -- function OnPluginSaveState
local font_height = WindowFontInfo (win, font, 1)
local max_width = WindowTextWidth (win, font, "Report")
local window_width = max_width + 10
local window_height = font_height * (#report + 2) + 10
-- make window correct size
tprint(windowinfo)
--WindowCreate (win,
-- windowinfo.window_left,
-- windowinfo.window_top,
-- window_width, window_height, -- width, height
-- windowinfo.window_mode,
-- windowinfo.window_flags,
-- ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- add the drag handler so they can move the window around
movewindow.add_drag_handler (win, 0, 0, 0, font_height)
The client complains
[string "Plugin"]:185: bad argument #7 to 'WindowCreate' (number expected, got nil)
I found out that when I try tprint(windowinfo) in the OnPluginInstall it is ok but outside it complains
MUSHclient\lua\tprint.lua:34: bad argument #1 to 'pairs' (table expected, got string)
So it doesnt know anything about table windowinfo. I use this construct in another plugin where only the OnPluginInstall is in <script> section and rest is in alias body.
I don't know why it doesn't work. I'm lost. Help please.
Thank you