[Plugin] Yet Another Lua Plugin

Started by Kalcor, SA:MP, Aug 08, 2023, 07:46 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

FrankJScott

To the man asking about driver 3 wood set, golf driver and wood sets, golf irons sets for sale, shopping golf, golf driver types, hybrid driver club, golf driver reviews, golf clubs with wooden heads, cool headcovers golf, home golf set, new golf club sets for sale, set of golf, types of woods golf, wood golf club set, all types of golf clubs, head golf, cool golf driver headcovers, last year's golf clubs for sale, woods covers, every type of golf club,  I recommend this experienced on premium golf headcovers site for head cover golf driver, golf club card, pxg clubs reviews, driver and hybrid covers, the club golf, golf club head covers set, driver fairway hybrid set, new fairway woods, best deal on golf club sets, pxg clubs good, 3 wood covers, head covers woods, complete golf clubs set, types of hybrid clubs, golf head covers 3 wood, the driver golf club, golf sticks for sale, style golf, fairway golf, golf wood sets for sale, full hybrid golf set, cheap 3 hybrid golf club, also. See More Cool Platelet Rich Plasma Therapy For Men Sarasota Site 2f8d49c

FrankJScott

For the guy inquiring about best natural botox, facial chemical peels before and after, platelet rich plasma with microneedling, best skin rejuvenation procedures, filler face injections, botox is used to treat, skin rejuvenation products, micro needling face lift, botox and laser treatment, best treatment for lines and wrinkles,  I highly suggest this high rated platelet rich plasma therapy for men sarasota blog or kybella fat dissolving, botox before laser treatment, dermal fillers last, facial needling treatment, best place for face fillers, botox used for, facial rejuvenation therapy, medical treatment for wrinkles, best treatment for lifting face, botox anti wrinkle injections, bearing in mind this more about the author on erectile dysfunction solutions sarasota site alongside all best chemical peel treatment, best treatment for smooth skin, lip enhancement, the best wrinkle fillers, laser light therapy for wrinkles, botox logo, the skin treatment, dermal filler lip enhancement, face rejuvenation laser treatment, treatment for frown lines around mouth, not to mention this best pshot services sarasota site which is also great. Also, have a look at this at bing for erectile dysfunction treatment sarasota url and don't forget plasma facial rejuvenation, anti wrinkles injections, best body treatments, cosmetic peel treatment, botox fat reduction, wrinkle skin treatment, wrinkle reduction procedures, best treatment for frown lines around mouth, laser face procedure, laser wrinkle reduction, which is worth considering with this useful erectile dysfunction solutions sarasota details not forgetting sites such as peel face treatment, platelet facial rejuvenation, cosmetic wrinkle treatment, laser skin, best treatment for skin tightening and wrinkles,  read full report on which is worth considering with frown lines best treatment, effective chemical peels, wrinkle mouth lines, anti wrinkle botox, prp skin care,  for good measure. Check more @ Top Rated Pshot Injections Sarasota Info d68456a

Kalcor, SA:MP

[Plugin] Yet Another Lua Plugin


Introduction

This plugin allows you to use Lua, your favourite dynamic flexible scripting language, in SA-MP, for all purposes, be it sandboxing user scripts, debugging the server, or developing filterscripts and gamemodes. YALP provides lightweight and flexible Lua environment that can use existing or future natives from SA-MP or plugins.



The main feature of YALP is a powerful interop API to interact with existing Pawn natives and callbacks. It is very easy to call existing functions, without needing to declare them anywhere:


Code:

interop.native.SetPlayerPos(0, 1235.31, -2331.84, 12.33)

YALP automatically converts all arguments to their proper Pawn cells, and allows you to specify what the function returns in the actuall call. All standard cell and single-dimensional array types are supported.



Callbacks can be specified in a similar simple way:


Code:

function interop.public.OnPlayerConnect(playerid)
  -- ...
end

Thanks to these mechanisms, you can use any framework you want, or build your own in Lua, without depending on new versions of this plugin.



Configuration

There is no special XML, JSON or other configuration of this plugin, because you can specify everything when you create a new Lua state (you can create any number you wish, and run any code inside). You can specify what packages should be loaded or available in the Lua instance, how much maximum memory it should take, or even limit for how long Lua functions can run.



Features

All standard Lua packages are available (although some of the more unsafe ones aren't allowed by default). The powerful interop package can interface with any Pawn native function or callback. There is also an advanced timer library with support for simple asynchronous functions (with Lua coroutines) and all sorts of timers. The remote package contains functions for remote communication between two separate Lua instance (via serialization or proxies).



The standard Lua packages are also enhanced with a couple of useful functions. Please see the wiki for a list of all new functions.



The Pawn API is basically a port of the Lua C API, allowing advanced manipulation of the Lua machine. It is recommended to use the Lua API, since it can do everything that Pawn can do, but if you need to interact with an existing complex Pawn library, it is possible as well.



Sample code


pawn Code:

#include <a_samp>
#include <YALP>

public OnFilterScriptInit()
{
    new Lua:l = lua_newstate(); // creates a new Lua instance
   
    if(lua_loadfile(l, "script.lua")) // loads a Lua script and returns an error code
    {
        lua_stackdump(l); // prints the stack for more information about the error
        return;
    }
    lua_bind(l); // binds the Lua instance to the current Pawn filterscript/gamemode, so all interation with it is rerouted to Lua
    // if the binding succeeds, this code is not run (and the Lua instance is destroyed if the script is unloaded)
    lua_stackdump(l);
}


Code:

-- script.lua
local interop = require "interop"
interop.native.print("Hello from Lua!")


Source: [Plugin] Yet Another Lua Plugin