content
stringlengths
5
1.05M
local Contiguous, parent = torch.class('nn.Contiguous', 'nn.Module') function Contiguous:updateOutput(input) if not input:isContiguous() then self.output:resizeAs(input):copy(input) else self.output:set(input) end return self.output end function Contiguous:updateGradInput(input, gradOutput) ...
-- Define default options and variables local CleanChat = { Title = "CleanChat", Version = "1.0", Author = "Rycerzodie", Loaded = false, LocalesPath = "Interface/AddOns/CleanChat/locales/", Locales = {}, PredefinedFilters = dofile( "Interface/Addons/CleanChat/db.lua" ), PredefinedFiltersSorted = d...
local data_track = { {2.4746666666667,"Eb",24}, {4.48,"Eb",30}, {4.5226666666667,"Eb",31}, {4.8853333333333,"Eb",28}, {6.4426666666667,"Eb",26}, {6.5493333333333,"Eb",24}, {8,"Eb",21}, {9.2373333333333,"Eb",24}, {9.3653333333333,"Eb",19}, {9.92,"Eb",17}, {10.005333333333,"Eb...
local skynet = require 'skynet' local log = require 'lnlog' local mc = require "multicast" local subrepos = {} function accept.pub(event,...) -- body local channel = subrepos[event] if channel then channel:publish(...) else log.info(event.." has no subscriber.ignore.") end end function response.sub(event) ...
resource_type 'gametype' { name = 'PropHunt' } client_scripts { 'client/PropHuntV.Client.net.dll' } server_scripts { 'server/PropHuntV.Server.net.dll' } files({ 'Newtonsoft.Json.dll', 'html/index.html', 'html/index.css', 'html/index.js', 'html/prophuntv.png', 'html/headshots/Acult02AMY.png', 'html/headshots...
return function(accessor) local status, tt = pcall(function() return accessor.to_table end) if status and tt then return tt(accessor) else return true end end
if a then local x = 3 if b then print(a, b) end end
-- usage: (use instead of ant) -- tolua++ "-L" "basic.lua" "-o" "../../scripting/lua/cocos2dx_support/LuaCocos2d.cpp" "Cocos2d.pkg" _is_functions = _is_functions or {} _to_functions = _to_functions or {} _push_functions = _push_functions or {} local CCObjectTypes = { "CCArmature", "CCArmatureAnimation", "...
-- Keeps track of the currently connected peers peers = {} peers[0] = { name = "ME!" } function connected(peer_id) log("connections", "CONNECTED TO " .. tostring(peer_id)) peers[peer_id] = { name = "N/A" } hi = Hello() hi.name = nodeid send(peer_id, hi, 1) end function disconnected(peer_id) log("connecti...
---@meta ---@class ccs.ColorFrame :ccs.Frame local ColorFrame={ } ccs.ColorFrame=ColorFrame ---* ---@return color3b_table function ColorFrame:getColor () end ---* ---@param color color3b_table ---@return self function ColorFrame:setColor (color) end ---* ---@return self function ColorFrame:create () end ---* -...
--[[ This module contains commonly used functions and higher order functions. ]] local func = {} function func.inc (n, c) if c == nil then return n + 1 else return n + c end end function func.dec (n, c) if c == nil then return n - 1 else return n - c end end function func.add (a, b) ...
local code_utils = require("refactoring.code_generation.utils") local function python_function(opts) if opts.func_header == nil then opts.func_header = "" end return string.format( [[ %sdef %s(%s): %s ]], opts.func_header, opts.name, table.concat(opts.args, ", "), ...
-- $Id: utf8.lua 179 2009-04-03 18:10:03Z pasta $ -- -- Provides UTF-8 aware string functions extended from Garry's Mod's utf8 module: -- * utf8.clen -- * utf8.sub(s, i, j) -- * utf8.upper(s) -- * utf8.lower(s) -- -- All functions behave as their non UTF-8 aware counterparts with the exception -- that UTF-8 characters ...
local MetaPlayer = FindMetaTable("Player") local EntityMeta = FindMetaTable("Entity") local Donators = { "vip", "donator" } function MetaPlayer:IsDonator() for _,v in pairs(Donators) do if self:IsUserGroup(v) then return true end end return false end -- Player Scores function MetaPlayer:Get...
local MOD = { id = "hadaka_mod", debug_enable = false } mods[MOD.id] = MOD --[[ 各種関数 ]] function MOD.debug(msg) if MOD.debug_enable then game.add_msg(tostring(msg)) end end function MOD.bp_toi(str) for k, v in pairs(enums.body_part) do if v == str then return k end end return nil en...
local t = Def.ActorFrame{}; t[#t+1] = Def.ActorFrame{ LoadActor("tunnel15")..{ InitCommand=cmd(FullScreen); }; }; return t;
SerialCacheManager = class("SerialCacheManager") SerialCacheManager.init = function (slot0) slot0._keyIndex = 1 slot0._objectType = { [Serial.CacheType.CacheType_Spine] = Serial.ObjectType.ObjectType_Cocos2dx, [Serial.CacheType.CacheType_Particle] = Serial.ObjectType.ObjectType_Cocos2dx, [Serial.CacheType.Cach...
local db = require 'std.database':new() db:update('crum', '攻擊力', function(lv) return lv*5 end) db:update('sde',"法術攻擊力", function(lv) return lv*2+3 end) return db
local M = {} local unpack = unpack or table.unpack M.partial = function (size, callback) local function recurse(...) local args = {...} if #args < size then return function (...) return recurse(unpack(args), ...) end elseif callback then return callback(unpack(args)) end ...
--[[ TheNexusAvenger Attack for a death ball. Class is static (should not be created). --]] local ReplicatedStorage = game:GetService("ReplicatedStorage") local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage")) local NexusObject = ReplicatedStorageProjec...
--Loads external libraries. local Globals = (...) or {} local Libraries = {} local function addLibrary(path,name) local lib, err = fs.load(path) if not lib then error("Failed to load library ("..name.."): "..err) end setfenv(lib,Globals) Libraries[name] = lib end addLibrary(_SystemDrive..":/Libraries/lume.l...
X = {} local IBUtil = require(GetScriptDirectory() .. "/ItemBuildlogic"); local npcBot = GetBot(); local talents = IBUtil.FillTalenTable(npcBot); local skills = IBUtil.FillSkillTable(npcBot, IBUtil.GetSlotPattern(4)); X["items"] = { "item_boots", "item_magic_wand", "item_tranquil_boots", "item_veil_of_discord",...
local lume = require('lib.lume') local reminder = require('lib.reminder') local data_handler = {} local order = { 'id', 'created_on', 'last_modified_on', 'state', 'time', 'addendum', 'skip_ref', 'days', 'months', 'years', 'weekdays', 'skipdays', 'message' } local lists_order = { 'days'...
function stringifyKernel(filenameIn, filenameOut, kernelMethod) local BUFSIZE = 1024*1024 -- 1MB local f = io.open(filenameIn,"r"); local fw = io.open(filenameOut,"w"); fw:write("//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project\n") fw:write(...
if SERVER then AddCSLuaFile() end ITEM.EquipMenuData = { type = "item_passive", name = "item_speedrun", desc = "item_speedrun_desc" } ITEM.CanBuy = {ROLE_TRAITOR, ROLE_DETECTIVE} ITEM.material = "vgui/ttt/icon_speedrun" hook.Add("TTTPlayerSpeedModifier", "TTT2SpeedRun", function(ply, _, _, speedMultiplierModifie...
local sw, sh = stage:getSize() local bgimg = Image.new("assets/images/background.png") stage:addChild(DisplayImage.new(bgimg)) local mask = DisplayShape.new(sw, sh) :setSource(Pattern.image(bgimg:clone():blur(120))) :paint() :setSource(Pattern.image(Image.new("assets/images/water.png"))) :paint() :setO...
------------------------------------------------------- -- nacl-cli -- Written by Erik Poupaert, Cambodia -- (c) 2018 -- Licensed under the LGPL ------------------------------------------------------- -- The origin of this function is a comment on stackoverflow -- It was contributed by its author t...
-- Jump Component -- local Base = require 'modern' local Jump = Base:extend() -- New -- function Jump:new(host, data) -- mini jump formula -- ref: https://2dengine.com/?p=platformers#Jumping local height = data.jumpTile or Config.world.tileSize * 6 local apexTime = data.apexTime or 0.4 local g = 2 * hei...
local type, setmetatable, tostring, select, unpack = type, setmetatable, tostring, select, unpack local ioo, iop, osrem = io.open, io.popen, os.remove local tmpfile = os.tmpname() local _EXIT = "exit" local _SIGNAL = "signal" local _TABLE = "table" local _FUNC, _STR, _NUM, _BOOL = "function", "string", "number", "bool...
----------------------------------------------------- PLUGIN.name = "Tying Improvements" PLUGIN.author = "Geferon" PLUGIN.desc = "Enables Tying players and searching them if they are tied with the F2 menu." function PLUGIN:ShowTeam(client) if not nut.plugin.list.tying then return end -- Tying plugin doesn't e...
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" if vim.fn.empty(vim.fn.glob(install_path)) > 0 then PACKER_BOOTSTRAP = vim.fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path, }) end vim.cmd([[packadd packer.nvim]]) lo...
-- mod-version:2 -- lite-xl 2.0 local core = require "core" local common = require "core.common" local command = require "core.command" local config = require "core.config" local keymap = require "core.keymap" local style = require "core.style" local RootView = require "core.rootview" local CommandView = require "core....
--this is NOT a template if (SERVER) then AddCSLuaFile( "shared.lua" ) end if ( CLIENT ) then SWEP.PrintName = "Glock GmbH 9mm" SWEP.Author = "cheesylard" SWEP.ViewModelFlip = true SWEP.CSMuzzleFlashes = true SWEP.NameOfSWEP = "rcs_glock" --always make this the name of the folder the SWEP is in. S...
-------------------------------------------------------------------------------- -- Acid resist gate -- -------------------------------------------------------------------------------- local acidResistGate = util.table.deepcopy(data.raw["item"]["gate"]) acidRes...
TestInherit = {} function TestInherit:testAExtnedsBContainsMethods() local a = BasicClassA:New() local b = BasicClassB:New() local c = BasicClassC:New() lu.assertNotIsNil( a ) lu.assertNotIsNil( b ) lu.assertNotIsNil( c ) lu.assertIsFunction( b.MyMethodFromB ) lu.assertNotIsFunction( a.MyMethodFromB ) lu.a...
--Automatically generated by SWGEmu Spawn Tool v0.12 loot editor. cape9 = { minimumLevel = 0, maximumLevel = -1, customObjectName = "Bounty Hunters Guild Cape", directObjectTemplate = "object/tangible/tcg/series8/wearable_bh_cape.iff", craftingValues = { }, customizationStringNames = {}, customizationValues = ...
/*============================================================================================== Expression Advanced: Component -> Prop Core. Creditors: Rusketh, Oskar94 ==============================================================================================*/ local LEMON, API = LEMON, LEMON.API local Componen...
return { no_consumer = true, fields = { cookie_name = { type = "string", default="SESSION" } } }
return { ["button.okay"] = "Ok", ["button.remove"] = "Remove", ["button.rename"] = "Rename", ["button.copy"] = "Copy", ["button.find"] = "Find", ["button.comment"] = "Turn off", ["button.uncomment"] = "Turn on", ["button.hide"] = "Hide", ["button.show"] = "Show", ["butt...
--- === cp.apple.finalcutpro.main.TranscodeMedia === --- --- Represents the Transcode Media sheet. --local log = require "hs.logger".new "TranscodeMedia" local axutils = require "cp.ui.axutils" local Button = require "cp.ui.Button" local CheckBox = require "cp.ui.CheckBox...
wampa = { description = "", minimumLevel = 0, maximumLevel = 0, lootItems = { {itemTemplate = "wampa_bones", weight = 2000000}, {itemTemplate = "wampa_bones_rare", weight = 1000000}, {itemTemplate = "wampa_blood", weight = 2000000}, {itemTemplate = "spoiled_wampa_blood", weight = 5000000}, } } addLootGr...
local uri_encode_component = require('./uri').encode_component --- Stringify query table -- @param params (table) query table to be stringified -- @return query_string (string) return function(params) local query_string = "" if next(params) then for key, val in pairs(params) do if type(val) == 'table' th...
--[[----------------------------------------------------------------------------- * Infected Wars, an open source Garry's Mod game-mode. * * Infected Wars is the work of multiple authors, * a full list can be found in CONTRIBUTORS.md. * For more information, visit https://github.com/JarnoVgr/InfectedWars * * Inf...
local quads = {} {{range .Sprites -}} quads['{{.Name}}'] = love.graphics.newQuad({{.Left}},{{.Top}},{{.Width}},{{.Height}},{{$.Width}},{{$.Height}}) {{end}} return quads
local utils = require("mp.utils") local msg = require("mp.msg") -- resolve url title and send it back to playlistmanager mp.register_script_message("resolveurltitle", function(filename) local args = { 'youtube-dl', '--flat-playlist', '--no-playlist', '-sJ', filename } local res = utils.subprocess({ args = args }) ...
local skynet = require "skynet" local socketManager = require("byprotobuf/socketManager") local socketCmd = require("logic/common/socketCmd") local TAG = 'RobotClient' local RobotClient = class() local SOCKET = {} function SOCKET.connected(socketfd) RobotClient.m_socketfd = socketfd Log.d(TAG, "RobotClient onconn...
-- Automatically generated by build.lua, do not edit return { require(script.Parent.DerivedCoreProperties1), require(script.Parent.DerivedCoreProperties2), require(script.Parent.DerivedCoreProperties3), require(script.Parent.DerivedCoreProperties4), require(script.Parent.DerivedCoreProperties5), ...
local _G = _G or getfenv(0) local strsplit = ShaguTweaks.strsplit local module = ShaguTweaks:register({ title = "Auto Stance", description = "Automatically switch to the required warrior or druid stance on spell cast.", expansions = { ["vanilla"] = true, ["tbc"] = nil }, enabled = nil, }) module.enable = func...
local core = require 'core.document-symbol' local files = require 'files' local define = require 'proto.define' rawset(_G, 'TEST', true) local EXISTS = {} local function eq(a, b) if a == EXISTS and b ~= nil then return true end local tp1, tp2 = type(a), type(b) if tp1 ~= tp2 then r...
-- This system changes the color of the laser when it hits an entity Name = "RayCastLaserSystem" Group = BlackFox.ComponentSystemGroup.GameLoop -- Aliases Color = BlackFox.Graphics.Color Ray = BlackFox.Physics.Ray -- Component IDs local Transform = BlackFox.Components.Spatial.Transform.id() local Line = BlackFox.Comp...
-- $Id: //depot/Projects/StarWars_Expansion/Run/Data/Scripts/GameObject/ObjectScript_Silri.lua#10 $ --///////////////////////////////////////////////////////////////////////////////////////////////// -- -- (C) Petroglyph Games, Inc. -- -- -- ***** ** * * -- * ** ...
do local ModScriptName="script.ExampleScript.lua" ModScripts["status"]["script.ExampleScript.lua"] = 0 ModScripts.RegisterRepeatFunction("ExampleScript.HelloWorld()",ModScriptName) ExampleScript={} function ExampleScript.HelloWorld() print("hello world") end end
global_params={ uri="qemu:///system", } start_domain_1={ type="start_domain", name="deadbeef-dead-beef-dead-beefdeadbeef", -- domain name or uuid } connect_xpra_client={ type="xpra_client", target="tcp://127.0.0.1:7777", tray=true, cmdline={"--pings=no","--notifications=no","--compressors=lz4","--encodi...
--[[ Synapse Xen v1.1.2 by Synapse GP VM Hash: e2ced3e4556868c42381a20c32bad40b5b749db01b509544d7d71fd3aeb611c3 ]] local SynapseXen_IIlilliII=select;local SynapseXen_llIlIlI=string.byte;local SynapseXen_IliIIl=string.sub;local SynapseXen_IIIIi=string.char;local SynapseXen_iIIliiliiiIlIIilIIl=type;local Synapse...
--[[Author: YOLOSPAGHETTI Date: July 15, 2016 Puts all the targets offset in front of the caster, and stuns them]] function ReversePolarity(keys) local caster = keys.caster local target = keys.target local ability = keys.ability local hero_stun_duration = ability:GetLevelSpecialValueFor("hero_stun_duration", ab...
supplyLimit("Fighter",50) supplyLimit("scout",20) supplyLimit("defenseFighter",40) supplyLimit("Corvette",40) supplyLimit("Frigate", 180) supplyLimit("fuelpod",20) supplyLimit("Capital", 120) supplyLimit("Utility",120) supplyLimit("ResourceCollector",96) supplyLimit("ResourceController",24) ...
io.stdout:setvbuf("no") -- make print() immediately appear in Output, instead of waiting until process exits function love.load() Object = require "classic" require "player" require "enemy" require "bullet" player = Player() enemy = Enemy() listOfBullets = {} end function love.update(dt) -- dt = de...
-- Final Krastorio 2 changes -- There are other K2 changes throughout local util = require("__bztitanium__.data-util"); if mods["Krastorio2"] then -- Titanium modifies flying robot frames, so use them in a reasonable tech card in Krastorio 2 util.replace_ingredient(data.raw.recipe["advanced-tech-card"], "electric-...
-------------------------------------------------------------------------------- -- Contains options required by run.lua -- -- Written by: Abhishek Chaurasia -- Dated: 6th June, 2016 -------------------------------------------------------------------------------- local opts = {} lapp = require 'pl.lapp' function...
--!A cross-platform build utility based on Lua -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law...
ide_Server = net.createServer(net.TCP) --Create TCP server if ide_Server then ide_Server:listen(8099, function(ideconn) --Listen to the port 80 editor(ideconn) end) end print ("Server code started")
local Craft = require('craft2') local itemDB = require('itemDB') local Milo = require('milo') local UI = require('ui') local Util = require('util') local turtle = _G.turtle local context = Milo:getContext() local function learnRecipe() local ingredients = Milo:getTurtleInventory() if not ingredients then...
// Wildfire Black Mesa Roleplay // File description: PAC3 restriction script // Copyright (c) 2022 KiwifruitDev // Licensed under the MIT License. //********************************************************************************************* // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR...
--====================================================================-- -- Kolor Advanced -- -- Shows that other libraries can create and use HDR display objects -- mixed in with dmc_kolor -- -- by David McCuskey -- -- Sample code is MIT licensed, the same license which covers Lua itself -- http://en.wikipedia.org/wik...
cow = {} cow.__index = cow function cow.create(x, y, speed) local self = setmetatable({}, cow) self.x = x self.y = y self.offScreen = false self.dying = false self.dead = false self.dead_remove = false self.dead_time = 0.5 self.speed = speed --self.img = love.graphics.newImage("img/cow1.png") self.animSpeed...
Locales ['nl'] = { ['input'] = 'Druk op ~INPUT_PICKUP~ om drugs aan te bieden', ['reject'] = 'Deze persoon heeft jouw aanbod ~r~afgewezen~s~', ['no_more_drugs'] = '~r~Je hebt ~s~ geen ~g~drugs meer!', ['too_far_away'] = 'Je bent te ver weg! Verkoop ~r~geannuleerd', ['remained'] = 'resterend~b~ ', ['you_have_sold'...
function ShowItemSetup ( uMsg ) local itemID = uMsg:ReadShort() local itemMod = uMsg:ReadEntity() local ourPanel = vgui.Create("DFrame"); ourPanel:SetSize(260, 185); ourPanel:SetPos(ScrW() * .5 - 130, ScrH() * .5 - 92.5); ourPanel:SetAlpha(GAMEMODE.GetGUIAlpha()); ourPanel:MakePopup(); ourPanel:SetTitle("S...
local MSQ = LibStub("Masque", true) if not MSQ then return end local AddOn, _ = ... local Version = GetAddOnMetadata(AddOn, "Version") MSQ:AddSkin("Gm_Sr", { Author = "gmarco", Version = Version, Shape = "Square", Masque_Version = 70200, Backdrop = { Width = 32, Height = 32, Texture = [[Inter...
local Portal = class("Editor.Portal") function Portal:initialize(editor) self.editor = editor self.level = self.editor.level end return Portal
local naughty = require("naughty") if awesome.startup_errors then naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, there were errors during startup!", text = awesome.startup_error }) end do local in_error = false awesome.connect_signal( "debug::error", function (err) if in_error...
-- Create PrecipitationType and PrecipitationForm from Potential parameter version -- Only for smartmet editor data -- partio 2018-02-16 local ppf = luatool:Fetch(current_time, level(HPLevelType.kHeight, 0), param("POTPRECF-N")) local ppt = luatool:Fetch(current_time, level(HPLevelType.kHeight, 0), param("POTPRECT-N")...
--[[****************************************************************************** Addon: Battlefield History Author: Cyprias License: MIT License (http://opensource.org/licenses/MIT) **********************************************************************************]] local folder, core = ... local Opt...
(function() -- Our Value-Cache to increase the performance on loop templates. local _spos_lru = {} -- A decorator generator for the LRU-Cache. local function _spos_decorate_lru(func, name) return function() local l = tenv.line local s = tenv.syl -- Query the cache so we don't have to...
pfDB["objects"]["enUS-turtle"] = { [276] = "Shimmerweed Basket", [1000000] = "Pile of Wood", [1000045] = "Shimmerweed Bush", [1000082] = "Stolen Elwynn Pumpkin", [1000250] = "Razlik's Tools", [1000370] = "Ripe Garden Pumpkin", [1000371] = "Garden Berry Bush", [1000372] = "Ripe Garden Watermelon", [100...
data:extend({ { name = "tnp-speechbubble", type = "speech-bubble", flags = { "not-on-map", "placeable-off-grid" }, style = "tnp_speechbubble" } })
local sharder = require('discordia-sharder') local shard_data = coroutine.wrap(sharder, 'bot.lua', { -- Options go here })() local ipc_emitter, shard_emitter, write = shard_data.ipc_emitter, shard_data.shard_emitter, shard_data.write -- Shard Emitter Functionalities shard_emitter:on('start', function(firstShardID,...
-- Version 2 of the project generator include("premake/config.v2.default.lua") dofileopt("config.v2.lua") include("premake/generator.lua")
local config_module = {} config_module["HOST"] = "shithouse.tv" config_module["TAGS"] = "./tags" config_module["BUMPS"] = "./tv" config_module["MD_NAME"] = "meta.json" config_module["TRUNCATE_LENGTH_S"] = "20" return config_module
Script.ReloadScript("scripts/MisDB/MisDB.lua") Script.ReloadScript("scripts/utils/MisDB.lua") -- -- Support for custom player spawns. -- RegisterCallbackReturnAware(Miscreated, "InitPlayer", function(self, ret, playerId) local DB = MisDB:Create("SpawnPointDB/", "SpawnPointData") local DBCollection = DB:Collection...
function SunfuryEradicator_OnEnterCombat(Unit,Event) Unit:CastSpell(38008) Unit:RegisterEvent("SunfuryEradicator_FlashHeal", 15000, 0) end function SunfuryEradicator_FlashHeal(Unit,Event) Unit:FullCastSpellOnTarget(17137,Unit:GetRandomFriend()) end function SunfuryEradicator_OnLeaveCombat(Unit,Event) Unit:RemoveE...
local counter = 0 local peak = 0 local ping = 0 local maxPing = 10000 local starttick = getTickCount ( ) local temp = "" local sx, sy = guiGetScreenSize ( ) local renderText = false local tick_2 = getTickCount ( ) addEvent ( "onClientPlayerLogin", true ) addEventHandler ( "onClientPlayerLogin", root, function ( ) r...
-- supporting testfile; belongs to 'cl_spec.lua' local setup = require 'busted'.setup local teardown = require 'busted'.teardown local before_each = require 'busted'.before_each local after_each = require 'busted'.after_each local assert = require 'busted'.assert local cli = require 'cliargs' cli:set_name('cl_helper_...
--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by BingLau. --- DateTime: 2021/7/8 23:44 --- 数据结构类 --- 1、必须初始化,没有默认值的概念(和CS结构体一样) --- 2、字符串全部初始化为空串:"" --- 3、table全部初始化为空表:{} --- 4、函数(比如回调)初始化为空函数:function() end --- 5、初始化一定不要使用nil--为nil的项lua会认为你是要删除这个项,全部设置为false --- 6、如果提供了__init函数但是实例化时不带参数或者参数不全,...
potions = {} potions.path = minetest.get_modpath("potions") local fly_potion1 = { affectid = "fly1", name = "Level 1 Fly Potion", stages = { { time = 120, custom = { chance=100, func = function(name, player, affectid) local pPrivs = minetest.get_player_privs(name) pPri...
Replicator:drop --------------. --[[| _ _ _ _ |____________________________ / | || || || ||_|___ _ _ /; /.--------------. /|___ +(_) (/) // / | _ _ _ _ | / ___ \ _ // / | || || || || |____/ ___ \...
Citizen.CreateThread(function() while true do if QBCore ~= nil then local ped = PlayerPedId() if not IsPedInAnyVehicle(ped, false) and GetEntitySpeed(ped) > 2.5 then if IsControlJustPressed(1, 19) and not spacePressed then Tackle() ...
local Players = game:GetService("Players") local Modules = Players.LocalPlayer.PlayerGui.AvatarEditorInGame.Modules local Roact = require(Modules.Packages.Roact) local UIBlox = require(Modules.Packages.UIBlox) local Images = UIBlox.App.ImageSet.Images local ImageSetLabel = UIBlox.Core.ImageSet.Label local withStyle ...
--[==[examples -- Get a random company logo url in PNG format. Faker.Company:logo() ]==] local Helpers = require "faker.helpers" local M = { __prefix = 'company', __fetched_methods = {'suffix', 'industry', 'profession'}, __parse_methods = {'name'}, } M.catch_phrase = function(self) local array_of_sets ...
local col = OutputColumns.Enemy(master) col.x = 0 col.y = 0 col.a = 0 col.v = 2 col.hp = 5 col.type = EnemyTypes.bow_tie_fairy_red col.del_out_of_after_coming_in = {-192, 192, -224, 224} function col:spark() OutputColumns.Enemy.spark(self) end return ParameterMatrix.ChainInit(master, n_row, n_col, matrix, col)
-- warp.lua -- Implements the /gowarp command and warps. Warps = {} function HandleGoWarpCommand(Split, Player) if Split[2] == nil then --No warp given, list warps available. Player:SendMessage(cChatColor.LightGray .. "Usage: " .. Split[1] .. " <warp>") elseif Warps[table.concat(Split, " ", 2)] == nil then P...
local PANEL = {} local paintFunctions = {} paintFunctions[0] = function(this, w, h) surface.SetDrawColor(0, 0, 0, 50) surface.DrawRect(0, 0, w, h) end paintFunctions[1] = function(this, w, h) end local HIGHLIGHT = Color(255, 255, 255, 50) function PANEL:Init() nut.gui.part...
_G.running = false -- tell the run loop to exit
function getModule(gui) gui.widgets = {} gui.widgets._defaultParameters = { visible = true, enabled = true, -- this is just a mode of display/interactivity (disabled as in 'greyed-out' - will not be updated) - not implemented in "default"-theme. virtual = false, -- will only be updated, ...
local stub = require("luassert.stub") local helpers = require("null-ls.helpers") describe("make_builtin", function() local opts = { method = "mockMethod", name = "mock-builtin", filetypes = { "lua" }, factory = stub.new(), generator_opts = { key = "val", ...
local identifiers = {} local function saveAppearance(identifier, appearance) SetResourceKvp(('%s:appearance'):format(identifier), json.encode(appearance)) end exports('save', saveAppearance) local function loadAppearance(source, identifier) local appearance = GetResourceKvpString(('%s:appearance'):format(identifier...
pistol_launcher = { minimumLevel = 0, maximumLevel = -1, customObjectName = "", directObjectTemplate = "object/weapon/ranged/pistol/pistol_launcher.iff", craftingValues = { {"mindamage",17,33,0}, {"maxdamage",91,169,0}, {"attackspeed",5.5,3.7,0}, {"woundchance",13,23,0}, {"hitpoints",750,750,0}, {"att...
local Number = {} Number.__index = Number function Number.new(args) local T = { param = { max = args.max, min = args.min, step = args.step, def = args.def, }, onTest = args.onTest, } return std.lua.setMetatable(T, Number) end function Number:test(v) local p = self.param ...
ESX = nil Citizen.CreateThread(function() while ESX == nil do TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end) Citizen.Wait(0) end end) local PlayerData = {} local Data = {} local GangLevels = { 1000, 2500, 6000, 9500, 12000, 15000, 19500, 24000, 28500...
slot0 = class("Favorite", import(".BaseVO")) slot0.STATE_AWARD = 1 slot0.STATE_WAIT = 2 slot0.STATE_LOCK = 3 slot0.STATE_FETCHED = 4 slot0.Ctor = function (slot0, slot1) slot0.configId = slot1.id slot0.id = slot0.configId slot0.star = slot1.star end slot0.bindConfigTable = function (slot0) return pg.storeup_data_...
object_mobile_force_storm = object_mobile_shared_force_storm:new { } ObjectTemplates:addTemplate(object_mobile_force_storm, "object/mobile/force_storm.iff")