Cours complet Lua API Manuel et support en PDF

Sommaire: Cours complet Lua API Manuel et support en PDF

Part I
About Lua
Part II
Introduction
Part III
Copyright information
Part IV
Programing model
Simple script
Object context
Result
Part V
Global functions
ConvertFromUTF16
FormatErrorString
GetAccountPassword
GetAccountUser
GetArgument
GetArgumentCount
GetLastError
GetObjectAddress
IsIDE
MessageBox
print
SetExitStatus
SetLastError
StoreStatisticalData
StoreStatisticalData
Wait
Part VI
LuaScriptEnumResult
Add
Part VII
LuaScriptConfigurator
AddArgument
SetCharacterLimits
SetNumericLimits
SetEntryPoint
SetAuthor
SetDescription
SetMinBuildVersion
SetScriptVersion
Part VIII
TLuaDateTime
Add
Create
CreateSpan
Equal
Get
GetDate
GetTime
Greater
GreaterOrEqual
Less
LessOrEqual
NotEqual
Set
Sub
Part IX
TLuaDB
ColCount
Connect
Connect(2)
Execute
GetCol
GetCol_AsDateTime
GetColType
GetErrorDescription
NextRow
ResultAvilable
Part X
TLuaDNS
Begin
End
GetErrorDescription
……..

Extrait du cours Lua API Manuel et support en PDF

1 About Lua
About Lua
Lua is a powerful light-weight programming language designed for extending applications. Lua is also frequently used as a general-purpose, stand-alone language. Lua is free software. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from byte codes, and has automatic memory management with garbage collection, making it ideal for configuration, scripting, and rapid prototyping.
KNM and Lua
Kaseya Network Monitor includes support for the Lua scripting language (www.lua.org).
Customers can create custom made monitors to test systems and equipment not supported by any current monitoring solution.
New monitors, actions and events can be created and tested in the development environment provided by Kaseya, before they are exported and used in Kaseya Network Monitor.
2 Introduction
This documentation covers the Kaseya Network Monitor Lua API. This documentation do not cover the Lua language, for more information about the Lua language visit http://www.lua.org.
KNM uses Lua 5.0.
3 Copyright information
Copyright © 2001-2011 Kaseya International Limited. All rights reserved.
SSH2 support powered by sshlib, Copyright (C) 2000-2011 by Bitvise Ltd, portions Copyright (C) 1995- 2011 by Wei Dai. All rights reserved Lua 5.0 license Copyright © 1994-2004 Tecgraf, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the « Software »), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 Programing model
When creating a custom Lua script for use in Kaseya Network Monitor there is a number of requirements that the script must fulfill in order to be successfully executed by Kaseya Network Monitor.
4.1 Advanced script
The advanced script model gives the script author new powerful tools to control parameters giving as arguments to the script. This makes it possible to make Lua scripts that have the same look and feel like native monitor types.
Reserved function names
There are two reserved function names, used by KNM to query information. These function names can not be used for any other purpose.
OnConfigure
This function is called by KNM to have the script populate a LuaScriptConfigurator class instance. The information is then used to create a user interface for the script. The name of the instance must be « Config » (note that casing) so KNM may find it in the Lua stack when the function returns.
OnEnumerate
Each field in the user interface can be enumerated, KNM calls the OnEnumerate function to have the script populate a data strcture, LuaScriptEnumResult, with values the user can select. The OnEnumerate have one parameter, sFieldToEnum, that is used by the script to determin which field/argument to provide enumeration results for. The returned instance must be named « Enum » (note the casing).
The entry point
The advanced script model requires the OnConfigure function to set the name of the entry point function.
This function is called by KNM to start the execution of the script. The name of the entry point is by default « main » but can be set by the programmer to any name except the reserved function names.
4.2 Simple script
The simple script model has been used in KNM since the first release and should now be seen as deprecated. Its maintained for compatibility with older scripts.
4.3 Object context
Functions are relative to the object context.
All calls that are accessing resources is relative to the parent object. For example, if the scripts opens a file the path supplied to the open function must be relative to the object.
4.4 Result
When an script exit it needs to tell KNM if the test was successful or not. A global function are provided for this purpose, SetExitStatus . SetExitStatus is mandatory and must be called before the script terminates.
5 Global functions
Global functions is functions not associated with an object. There is a number of global functions in the KNM Lua API, some is required to call when a scripts exit.
5.1 ConvertFromUTF16
string ConvertFromUTF16(local UTF16data,int iSize)
Return values
A 8 bit string converted from the UTF16 string.
Parameters
UTF16data
UTF16 (double byte) string read by TLuaFile::ReadData.
iS ize
Size of string.
Remarks
The function only accepts data created by the TLuaFile::ReadData function.
5.2 FormatErrorString
string FormatErrorString(int iError)
Return values
A string describing the error code iError.
Parameters
iEr r or
An Windows error code obtained previously by calling the GetLastError function.
Remarks
This function can be useful supplying meaningful text to the user instead of an error code.
5.3 GetAccountPassword
string GetAccountPassword()
Return values
The password of the logon account selected in the monitor.
Remarks
A calling application can pass an account to a Lua script for customize logon behaviour. Note that this function always returns an empty string in the IDE and is only meaningful in a script executed by KNM.
…….

LIRE AUSSI :  Computational Audiovisual Composition Using Lua

Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
Cours complet Lua API Manuel et support en PDF (1.44 MB) (Cours PDF)
Lua API

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *