content stringlengths 5 1.05M |
|---|
local setmetatable, getmetatable = setmetatable, getmetatable
local unpack = unpack or table.unpack
local type = type
local _M = {}
local stop = {}
_M.stop = stop
---
-- helper functions
--
local helpers = require "nozzle.helpers"
local split = helpers.split
local is_callable = helpers.is_callable
---
-- Generic Pi... |
---
--- 全局限流 RESTFUL API
--- Copyright (c) GoGo Easy Team & Jacobs Lei
--- Author: Jacobs Lei
--- Date: 2018/5/2
--- Time: 上午10:45
local global_cache = require("core.cache.local.global_cache_util")
local global_cache_prefix = require("core.cache.local.global_cache_prefix")
local plugin_config = require("plugins.global... |
local utils = require("utils")
local vimp = require("vimp")
local cnoremap = vimp.cnoremap
local inoremap = vimp.inoremap
local nnoremap = vimp.nnoremap
local xnoremap = vimp.xnoremap
function n_silent(...)
nnoremap({"silent"}, ...)
end
function x_silent(...)
xnoremap({"silent"}, ...)
end
x_silent(".", ":normal... |
function love.conf(t)
t.version = "0.10.1" -- The LÖVE version this game was built with
-- Same resolution as my phone. Independence later!
t.window.width = 800
t.window.height = 600
t.accelerometerjoystick = false
t.window.title = "physics"
t.window.borderless = false
t.window.fullscreen = false
... |
iron_claw_absorbing_skin_modifier = class({})
function iron_claw_absorbing_skin_modifier:OnCreated( kv )
self.damage_to_attack_damage_percentage = self:GetAbility():GetSpecialValueFor("damage_to_attack_damage_percentage")
self.damage_to_move_speed_percentage = self:GetAbility():GetSpecialValueFor("damage_to_move_spe... |
permtable = { 1234 }
function testcounter(counter)
local a = counter.cur()
counter.inc()
return counter.cur() == a + 1
end
function testuvinthread(func)
local success, result = coroutine.resume(func)
return success and result == 5
end
function test(rootobj)
local passed = 0
local total = 0
local dote... |
-- Project: LOOP - Lua Object-Oriented Programming
-- Title : Component Model with Dynamically Adaptable Containers
-- Author : Renato Maia <maia@inf.puc-rio.br>
local _G = require "_G"
local next = _G.next
local rawget = _G.rawget
local select = _G.select
local type = _G.type
local oo = require "loop.cached"
local... |
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_init.lua")
include("shared.lua")
ENT.DisableDuplicator = true
ENT.DoNotDuplicate = true
ENT.ViewChecks = 2
local util = util
local CAI = CAI
local Detection = CAI.Detection
local Utils = CAI.Utilities
local Result = {}
local Trace = { start ... |
-- keymaps
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, si... |
--[[
Copyright 2014 Google Inc. All Rights Reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
]]
--[[
Script to download and save mnist data.
- gets files from Yann LeCun's web site (http://yann.l... |
#!/usr/bin/env lua
-- @copyright 2011-2014, Gianluca Fiore © <forod.g@gmail.com>
--- Converts seconds into minutes as MM:SS
--@param secs the integer with the seconds
function secs2mins(secs)
local secs = tonumber(secs)
if secs > 59 then
local minutes = math.floor(secs/60)
local seconds = secs - (minutes * 60)
... |
---------------------------------------------------------------------------------------
-- @function string模块测试
-- @author ArisHu
-- @Note
---------------------------------------------------------------------------------------
package.path = "?.lua"
local lcstring = require("legend.common.string")
... |
return {
init_effect = "",
name = "被icelf命中10次时触发破甲",
time = 0,
picture = "",
desc = "",
stack = 10,
id = 403,
icon = 400,
last_effect = "",
effect_list = {
{
type = "BattleBuffCount",
trigger = {
"onStack"
},
arg_list = {
countTarget = 10,
countType = 403
}
},
{
type = "Ba... |
local socket = _G.do_input.socket
local host = _G.do_input.host
local path = _G.do_input.path
local add_header = _G.do_input.add_header
local mrandom = math.random
local toBase64 = crypto.toBase64
local pack_bytes = string.char
local band = bit.band
local rshift = bit.rshift
local hash = crypto.hash
local guid = "2... |
local StoreProvider = require(script.StoreProvider)
local connect = require(script.connect)
return {
StoreProvider = StoreProvider,
connect = connect,
UNSTABLE_connect2 = connect,
} |
require('luacov')
local testcase = require('testcase')
local header = require('reflex.header')
function testcase.new()
-- test that return new Header
assert(header.new())
end
function testcase.set()
local h = header.new()
-- test that set key-value pair
assert(h:set('foo', 'bar'))
-- confirm
... |
ROLE_CARRY = 1
ROLE_MID = 2
ROLE_OFFLANE = 3
ROLE_SEMISUP = 4
ROLE_FULLSUP = 5
ROLE_GANKER = 6
ROLE_JUNGLER = 7 |
--[[ Copyright (C) 2018 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope th... |
---------------------------------------------
-- Mana Storm
--
-- Description: Steals MP from players within range.
-- Type: Magical
-- Utsusemi/Blink absorb: Unknown
-- Range: Unknown radial
-- Notes:
---------------------------------------------
require("scripts/globals/monstertpmoves")
require("scripts/globals/setti... |
--[[
Copyright (c) 2015 深圳市辉游科技有限公司.
--]]
local MessageBox = class('MessageBox')
local utils = require('utils.utils')
function MessageBox.extend(target, ...)
local t = tolua.getpeer(target)
if not t then
t = {}
tolua.setpeer(target, t)
end
setmetatable(t, MessageBox)
if type(target.ctor) == 'functio... |
local ActionType = require(script.Parent.ActionType)
return function(remoteEvent)
return function()
local plugin = {}
function plugin:beforeSystemStart(core)
local function handleCoreAction(action)
local payload = action.payload
if action.type == ActionType.AddComponent then
core:addComponent(pa... |
require "core/transform"
require "core/color"
Label = Transform:new()
Label.text = ""
Label.font = nil
Label.color = 0x000000ff
function Label:draw()
if self.font == nil or self.text == nil then return end
love.graphics.setFont(self.font)
love.graphics.setColor(convertColor(self.color))
love.graphics... |
include "app.ui.base.init"
include "app.ui.SelectUI"
include "app.ui.AuthorInfoUI"
include "app.ui.SaveDisplayUI"
include "app.ui.DialogUI"
include "app.ui.EditBoxUI"
include "app.ui.DropList"
include "app.ui.ItemUI"
include "app.ui.LogUI"
include "app.ui.RoleUI"
include "app.ui.LoaderUI"
include "app.ui.MissionUI"
inc... |
local level = Base:extend()
local sti = require 'libs/sti'
local mario = require 'src/sprites/mario'
local brick = require 'src/sprites/brick'
local block = require 'src/sprites/block'
local mushroom = require 'src/sprites/mushroom'
local up = require 'src/sprites/1up'
local goomba = require 'src/sprites/goomba'
loca... |
return _csharp_getType("system.threading.LuaThread"); |
require 'cutorch'
local tester
local test = {}
local msize = 100
local minsize = 100
local maxsize = 1000
local function float(x)
if type(x) == 'number' then
return x
else
return x:float()
end
end
local function isEqual(a, b, tolerance, ...)
local diff = a-b
tolerance = tolerance or 0.00... |
-- Buildat: client/api.lua
-- http://www.apache.org/licenses/LICENSE-2.0
-- Copyright 2014 Perttu Ahola <celeron55@gmail.com>
local log = buildat.Logger("__client/api")
buildat.connect_server = __buildat_connect_server
buildat.extension_path = __buildat_extension_path
buildat.get_time_us = __buildat_get_ti... |
EMod = EMod or {}
--
EMod.Components = EMod.Components or {}
EMod.Entities = EMod.Entities or {}
--
EMod.Zero = "ZERO"
EMod.Plus = "ANODE"
EMod.Minus = "KATHODE"
EMod.HighVoltage = 0
EMod.CommonVoltage = 1
EMod.LowVoltage = 2
--
EMod.ComponentsTypes = {}
EMod.ComponentsTypes.Source = 0
EMod.ComponentsTypes.Passive = 1
... |
local comparisonOperatorHelper = require("ComparisonOperatorHelper")
local function ComparisonOperatorHelperTest_evaluate()
assert( comparisonOperatorHelper.evaluate("Equals", false, false, "test1", "test1",nil) )
assert( comparisonOperatorHelper.evaluate("Equals", false, false, "test1", "Test1",nil) == false )
ass... |
module("ircModes", package.seeall)
--IRC MODE STUFF
function setMode(chan,mode,tar)
if not tar then return end
if chan:sub(1,1)=='#' then
ircSendRawQ("MODE "..chan.." "..mode.." "..tar)
else
local _,_,channel,target = tar:find("^(.-)%s(.+)[^%s-]?")
if channel and target then
ircSendRawQ("MODE "..channel.."... |
for k, v in pairs(t) do
if f() and g(a or b) then
print("yes")
else
print("no")
end
end
|
object_static_structure_content_meatlump_meatlump_lump_unmarked = object_static_structure_content_meatlump_shared_meatlump_lump_unmarked:new {
}
ObjectTemplates:addTemplate(object_static_structure_content_meatlump_meatlump_lump_unmarked, "object/static/structure/content/meatlump/meatlump_lump_unmarked.iff")
|
local undump = require 'backend.worker.undump'
local version
local function getproto(content)
local evaluate = require 'backend.worker.evaluate'
local ok, bin = evaluate.dump(content)
if not ok or type(bin) ~= "string" then
return
end
local cl, v = undump(bin)
version = v
return cl... |
--[[
* ******************************************* *
* Developed by: -Rex- *
* Last modified: 26/01/2018 *
* Description: *
* ******************************************* *
]]--
local connection = dbConnect( "sqlite", "dbData_byRex.db" )
function update_join( player )
connection:exec( "UPDATE g... |
local util = util
--- JSON library
-- @name json
-- @class library
-- @libtbl json_library
SF.RegisterLibrary("json")
return function(instance)
local json_library = instance.Libraries.json
--- Convert table to JSON string
--@param tbl Table to encode
--@param prettyPrint Optional. If true, formats and indents th... |
_hx_error=function(msg)print("SFHaxe Runtime Error:\n "..tostring(msg))end
_hx_tostring=tostring |
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may ... |
local utils=require('utils')
getMinMax=function(minMax1,minMax2)
if not minMax1 then
return minMax2
end
if not minMax2 then
return minMax1
end
local ret={math.min(minMax1[1],minMax2[1]),math.max(minMax1[2],minMax2[2]),math.min(minMax1[3],minMax2[3]),math.max(minMax1[4],minMax2[4])}
... |
function love.conf(t)
t.title = "Pong Clone"
t.version = "0.10.1"
t.window.width = 1920 * (2/3)
t.window.height = 1080 * (2/3)
-- For Windows debugging
t.console = false
end
|
--[[
-- chatroom/anchor.lua
-- 主播模块,包括主播的初始化定义和约束等,主播包含主播的id,用户信息,主播关联的房间信息
--
-- Author: Steven.com <zhangliutong@zhengsutec.com>
-- 2017.03.12
--]]
local _CHATROOM_ERR = require "chat_room.chat_room_err"
local _M = {
anchor_user_code = "",
anchorName = "",
anchorDes = "",
anchorLogo = "", -- URL图片地址
anchorEff... |
--- @module sound
local m_sound = {}
local snd_apple_bite = nil
local snd_death = nil
local snd_the_end = nil
-------------------------------------------------------------------------------
function m_sound.init()
local music = love.audio.newSource("FurElise.ogg", "stream")
music:setLooping(true)
music:pla... |
require('qdigest')
function dump(label, obj)
print(string.format('%s:', label))
for k, v in pairs(obj) do
print(string.format(' %s: %s', k, v))
end
end
d = qdigest:new(8)
d:offer(0)
d:offer(1)
dump('1st dump', d)
d:offer(2)
dump('2nd dump', d)
--[[
d:offer(3)
d:offer(4)
--]]
print(string.format('quantile(... |
settings = {
weapon = get("weapon"):lower() == "all" and "all" or split(get("weapon"), ",") or "all",
maxVehicles = math.max(tonumber(get("maxvehicles")) or 25, 1),
destoryAfter = math.max(tonumber(get("destoryafter")) * 1000 or 50000, 50),
vehicleSpeed = tonumber(get("vehiclespeed")) or 4,
loc... |
function stim_pack_activate(keys)
local hCaster = keys.caster;
local fCurrentHealth = hCaster:GetHealth();
local fLifeCost = hCaster:GetMaxHealth()*keys.ability:GetSpecialValueFor("life_cost")/100;
if fCurrentHealth > fLifeCost then
hCaster:SetHealth(fCurrentHealth-fLifeCost);
else
hCaster:SetHealth(1);
end
e... |
-- -*- mode: lua; tab-width: 2; indent-tabs-mode: 1; st-rulers: [70] -*-
-- vim: ts=4 sw=4 ft=lua noet
----------------------------------------------------------------------
-- @author Daniel Barney <daniel@pagodabox.com>
-- @copyright 2015, Pagoda Box, Inc.
-- @doc
--
-- @end
-- Created : 15 May 2015 by Daniel Barne... |
-- ----------------------------------------------
-- Copyright (c) 2018, CounterFlow AI, Inc. All Rights Reserved.
-- author: Andrew Fast <af@counterflowai.com>
--
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE.txt file.
-- ---------------------------------------------... |
gui = {}
function gui.Init()
gui.bar = {}
gui.bar.tex = love.graphics.newImage("resources//gui//bar.png")
gui.pause = {}
gui.pause.tex = love.graphics.newImage("resources//gui//pause.png")
gui.death = {}
gui.death.tex = love.graphics.newImage("resources//gui//death.png")
end
fun... |
include("terms")
style =
{["off_color"] = "fff",
["on_color"] = "fff",
["line_color"] = "000",
["line_width"] = "0.2"};
dot_style =
{["off_color"] = "none",
["on_color"] = "fff",
["line_color"] = "000",
["line_width"] = "1"};
red_style =
{["off_color... |
local uv = vim.loop
local mpack = require('mpack')
local Actor = require('actor')
local messages = require('messages')
ParallelTask = {}
function ParallelTask:new ( actor_count, callback)
local o = { actor_count = actor_count, actors = {}, callback = callback }
self.input_queue = {}
self.output_queue = {}
se... |
do
local _ = {
['fill-lubricant-barrel'] = {
allow_decomposition = false,
name = 'fill-lubricant-barrel',
icon_mipmaps = 4,
localised_name = {'recipe-name.fill-barrel', {'fluid-name.lubricant'}},
type = 'recipe',
icons = {
... |
local M = {}
M.setup = function()
require'compe'.setup {
enabled = true,
autocomplete = true,
debug = false,
min_length = 1,
preselect = "enable",
throttle_time = 80,
source_timeout = 200,
incomplete_delay = 400,
max_abbr_width = 100,
max_kind_width = 100,
max_menu_width =... |
-- Add the directory containing this script to package.path
-- NOTE: this works ONLY if the script is run from cmd, not if it's required
do
-- Path is the path to the directory containing this script. If this is
-- run from within the same directory it is empty, hence the check
local path = arg[0]:match("(.... |
--[[
Copyright 2016 Iris Blanche
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 or agreed to in... |
object_tangible_loot_misc_marauder_token = object_tangible_loot_misc_shared_marauder_token:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_misc_marauder_token, "object/tangible/loot/misc/marauder_token.iff")
|
-- This file is for use with Corona(R) SDK
--
-- This file is automatically generated with PhysicsEdtior (http://physicseditor.de). Do not edit
--
-- Usage example:
-- local scaleFactor = 1.0
-- local physicsData = (require "shapedefs").physicsData(scaleFactor)
-- local shape = display.newImage("objectname.png")
... |
Vec2 = require 'lib/vector2'
Class = require 'lib/middleclass/middleclass'
Timer = require 'lib/vrld/timer'
_G.Resource = require 'resource'
_G.sugar = require 'lib/sugar'
_G.util = require 'misc/util'
_G.switch = require 'lib/switch'
_G.random = math.random
-- Global variables (Game Contants)
_G.Direction = {LEFT =... |
require "common/class"
require "common/functions"
require "QuadTree"
require "EventType"
require "DrawLayer"
Secretary = buildClass()
--
-- CONSTRUCTOR
--
function Secretary:_init( )
-- Collision detection data structure
self.tree = QuadTree( 1, -1000, 1000, 1000, -1000 )
self.paused = false
self.obje... |
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
function love.load()
love.window.setMode(WINDOW_WIDTH, WINDOW_HEIGHT, {
fullscreen = false,
resizable = false,
vsync = true})
end
function love.draw()
love.graphics.printf("Welcome to PONG", 0, WINDOW_HEIGHT/2, WINDOW_WIDTH, 'center')
end
|
---------
-- token api calls
local http, url = ...
--- exchanges an acces_token with a jwt token (for authorized http calls)
-- @param name the username
-- @param access_token the access code of the token (used in "/bx_login <username> <access_token>")
-- @return a promise with the result
function blockexchange.api.g... |
local Base = cc.import(".Base")
local Role = cc.class("Role", Base)
local Table = cc.import("#Table", ...)
--local dbConfig = cc.import("#dbConfig")
function Role:ctor()
Role.super.ctor(self, Table.Role)
end
function Role:Initialize(db, pid)
if not db or not pid then
return nil, "NoParam"
end
... |
minetest.register_craft({
output = "pollution:qbarrel_empty",
recipe = {
{"default:steel_ingot","group:sand","default:steel_ingot"},
{"default:steel_ingot","group:sand","default:steel_ingot"},
{"default:steel_ingot","group:sand","default:steel_ingot"},
},
})
minetest.register_craft({
output = "po... |
local testwin = window.new("Sine Wave")
do
testwin:setMinDimensions(nil,180)
local timer = 0
local r,g,b = math.random(0,255),math.random(0,255),math.random(0,255)
local orr,org,orb = r,g,b
local tr,tg,tb = math.random(0,255),math.random(0,255),math.random(0,255)
local totim = 0.5
local atrit = 0
e... |
SF.Vectors = {}
--- Vector type
-- @shared
local vec_methods, vec_metamethods = SF.RegisterType("Vector")
local function wrap(tbl)
return setmetatable(tbl, vec_metamethods)
end
local function unwrap(obj)
return Vector(obj[1], obj[2], obj[3])
end
local function vwrap(vec)
return wrap({ vec[1], vec[2], vec[3] })
e... |
--晕眩随机一个敌人
local info = ...
local target = info.target
Common_UnitAddBuff(nil, target, 7008, 1)
RemoveRandomBuff(); |
listAirplaneFrames = {}
cloud = {
initPosition = {screen.width + 167, math.random(screen.height)}, -- {x,y}
frameScale = {600,355}, -- {w,h}
max = 3
}
spawnedClouds = {}
ammoBoxes = {}
scorefont = love.graphics.newFont("font/Kamikaze3DGradient.ttf", 32)
score = {
points = love.graphics.newText(scorefont, "0"... |
local coverage = require('charon.coverage')
local test = {}
test.should_return_a_nil = function()
assert( coverage.reset() == nil )
end
test.should_return_differente_table_is_a_dump = function()
local result = coverage.dump()
coverage.reset()
assert( result ~= coverage.dump() )
end
return test
|
-----------------------------------
--
-- Zone: Temenos (37)
--
-----------------------------------
local ID = require("scripts/zones/Temenos/IDs");
require("scripts/globals/conquest");
require("scripts/globals/settings");
require("scripts/globals/limbus");
-----------------------------------
-------------------------... |
xsys = xsys or {}
xsys.xban = xsys.xban or {}
xsys.xban.NetStrings = {
Msg = "XbanMsg",
Restrict = "XBanRestrict"
}
local PlayerMeta = FindMetaTable("Player")
PlayerMeta.VoidBan = PlayerMeta.VoidBan and PlayerMeta.VoidBan or PlayerMeta.Ban
function PlayerMeta:IsBanned()
return self:GetNWBool("XsysBanned... |
ITEM.name = "Jerrycan"
ITEM.description = "A jerrycan filled with water."
ITEM.model = "models/props_junk/metalgascan.mdl"
ITEM.uniqueID = "jerryfilled"
if (CLIENT) then
function ITEM:PaintOver(item, w, h)
draw.SimpleText("Full", "DermaDefault", 5, h - 5, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM, 1,... |
local Memoize = require(script.Parent.Parent.Utility.Memoize)
local CatchFactory = Memoize(function(FunctionName: string)
return function(Error)
warn(string.format("[CatchFactory] - Error in function %s: %s", FunctionName, tostring(Error)))
end
end)
return CatchFactory
|
---------------------------------------------------
-- Grim Halo
-- Deals damage to a all targets. Additional effect: Knockback
-- Only used by Fomors that wield a two-handed weapon (principally WAR, BLM, DRK, SAM, DRG, and SMN fomors).
---------------------------------------------
require("scripts/globals/monstertpmov... |
local protocol = require "lua-nsq.protocol"
local protocol_dpublish = protocol.dpublish
local protocol_mpublish = protocol.mpublish
local protocol_subscribe = protocol.subscribe
local type = type
local assert = assert
local class = require "class"
local nsq = class("nsq")
function nsq:ctor(opt)
assert(type(opt) =... |
local pairsSorted = (require"harmonize.util").pairsSorted
local help = require"harmonize.util".help
local commands = {}
commands.__help = "Control and view dependencies."
commands.check = help("Print dependency information to stdout.")(function(arg)
local pkg = require"pkg"
local checkdeps = require"harmonize.c... |
--from itertools import count
local main = script.Parent.yaku_list
AkaDora = require(main.aka_dora)-- import AkaDora
Chankan = require(main.chankan)-- import Chankan
Chantai = require(main.chantai)-- import Chantai
Chiitoitsu = require(main.chiitoitsu)-- import Chiitoitsu
Chinitsu = require(main.chinitsu)-- import Ch... |
require 'SltRuntime'
function round(x)
return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5)
end
unsafeRound = SltThunk.create(
function() return
SltFunc.create(
function(a) return
SltNum.create(round(a().value), a().pos)
end,
{7, 1, "intify.lua"... |
class = require('pl.class')
class.MultilineTrigger()
function MultilineTrigger:_init(script, group, sequence)
self.lines = {}
self.text = ''
self.script = script or ''
self.group = group or ''
self.sequence = sequence or 100
end
function MultilineTrigger:Line(text, regexp, omit)
regexp = regexp or false
... |
return {
Base = Color3.fromRGB(235, 235, 235),
Underline = Color3.fromRGB(27, 184, 198),
TransparentButton = Color3.fromRGB(198, 198, 198),
RedButton = Color3.fromRGB(198, 89, 89),
DarkerButton = Color3.fromRGB(125, 125, 125),
Highlighted = Color3.fromRGB(152, 246, 255),
BaseDarker = Color3.fromRGB(189, 189, 1... |
--[[ Author: Firetoad
Date: 12.05.2017 ]]
if modifier_imba_donator_statue == nil then
modifier_imba_donator_statue = class({})
end
function modifier_imba_donator_statue:CheckState()
local state = {
[MODIFIER_STATE_NOT_ON_MINIMAP] = true,
}
return state
end
function modifier_imba_donator_statue:GetStatusEffe... |
require 'torch'
local box_utils = require 'densecap.box_utils'
local tests = {}
local tester = torch.Tester()
function tests.xcycwh_test()
local boxes_in = torch.Tensor(1, 10, 4)
boxes_in[{1, 1}] = torch.Tensor{0.5, 8.5, 7, 5}
boxes_in[{1, 2}] = torch.Tensor{3.5, -0.5, 9, 7}
boxes_in[{1, 3}] = torch.Tens... |
--- extends go.
-- @author [Alejandro Baez](https://twitter.com/a_baez)
-- @coypright 2015
-- @license MIT (see LICENSE)
-- @module go
local snipping = {
true,
const = 'const %1(name) %2(type) = %3(value)',
-- functions
fn = 'func %1(name)(%2(arguments))%3( (%4(results))) {\n\t%0\n}',
fna = 'func(%1(argum... |
-- turtle.lua
-- FR bibliotheque interne, incluse quand on appelle require("turtle")
-- FR fournit des fonctions pour l'affichage graphique en mode "tortue"
-- EN internal library, included when one calls require("turtle")
-- EN defines functions for "turtle" graphics
turtle={}
function turtle.pen... |
-------------------------------------------------------------------------------
-- File: game.lua
-- Project: RatOut
-- Author: Cristian Cobzarenco
-- Description: Game rig, root rig which manages application state.
--
-- All rights reserved. Copyright (c) 2011-2012 Cristian Cobzarenco.
-- See http://ww... |
local connection
if (getServerPort() == 22003) then
connection = dbConnect("mysql","dbname=admin_mtasa;host=127.0.0.1","putMySQLDatabase","PutYourPasswordIn")
else
connection = dbConnect("mysql","dbname=admin_mtadev;host=127.0.0.1","putMySQLDatabase","PutYourPasswordIn")
end
-- Get the MySQL connection eleme... |
local is_base_qtype = require 'Q/UTILS/lua/is_base_qtype'
return function (
src_val_qtype, --
dst_val_qtype, --
optargs
)
local to_scalar = require 'Q/UTILS/lua/to_scalar'
local qconsts = require 'Q/UTILS/lua/q_consts'
assert(optargs)
assert(type(optargs) == "table")
local nR2 = assert(optargs.nR... |
-- Component for handling the ModifierGained Filter used for spell effect blocking
-- from the Postactive 3c Reflex Item (Bubble Orb)
if not BubbleOrbFilter then
DebugPrint("Creating filter for Preemptive 3c (Bubble Orb)")
BubbleOrbFilter = class({})
Debug.EnabledModules["reflexfilters:bubble"] = false
end
fun... |
local mob_names = {} -- list<name>
minetest.register_on_mods_loaded(function()
for _,item in pairs(minetest.registered_items) do
if item.groups.spawn_egg == 1 then
table.insert(mob_names, item.name)
end
end
end)
-- playername => pos
local punch_handler = {}
local update_formspec = function(meta)
local pos... |
local pf = require 'eonz.polyfill'
local options = require 'eonz.options'
local function equals_impl(a, b, recursive)
if rawequal (a, b) then
return true
end
if type(a) ~= 'table' or type(b) ~= 'table' then
return false
end
local compared = {}
for key, v_a in pairs(a) do
local v_b = b[key]
if v_a ~=... |
fiber = require('fiber')
box.once()
box.once("key")
box.once("key", "key")
box.once("key", nil)
box.once("key", function() end)
once = nil
function f(arg) if once ~= nil then once = once + arg else once = arg end end
box.once("test", f, 1)
once
box.once("test", f, 1)
once
-- Check that box.once() does not fail if t... |
local lclient = require 'lclient'
local util = require 'utility'
local ws = require 'workspace'
local files = require 'files'
local furi = require 'file-uri'
local fs = require 'bee.filesystem'
local libraryPath = LOGPATH .. '/large-file-library'
local largeFilePath = LOGPATH .. '/large-file-librar... |
--
-- The unforgiving energy interface, if you didn't define the functions properly,
-- this WILL BLOW UP IN YOUR FACE.
--
-- The energy system operates on four main groups of nodes:
-- * `energy_producer`
-- Energy production is the first step in all ticks, `energy_producer` nodes
-- are expected to implement `pro... |
local _test = TEST or require "u-test"
local _ok, _exString = pcall(require, "eli.extensions.string")
if not _ok then
_test["eli.extensions.string available"] = function()
_test.assert(false, "eli.extensions.string not available")
end
if not TEST then
_test.summary()
os.exit()
e... |
--
-- Author: zen.zhao88@gmail.com
-- Date: 2015-12-04 11:00:50
--
local WeightSelector = class("WeightSelector",b3.Composite)
function WeightSelector:onOpen(tick)
printf("WeightSelector:onOpen")
tick.agent:set("runningChild",nil,tick.tree.id,self.id)
end
function WeightSelector:onTick(tick)
--初始化权重值
if not self.... |
-- Class - provides services for classes; those are emulated
-- by protoype elements as described in the Lua Reference
-- Manual
--
-- author: Dr. Thomas Tensi, 2019-08
-- ------------------
-- CLASS DECLARATIONS
-- ------------------
Class = {}
ClassWithPeer = {}
-- ===========
-- class Class
-- =... |
local myNAME = "merCraftingWritFilters"
local Language = GetCVar("Language.2")
local PlayerInventory = PLAYER_INVENTORY
local g_playerName = nil
local g_craftingQuests = {}
local g_parsingTests = {}
local getItemNameFromCondition
-- NOTE: explicitly limit gsub replacements to 1 ('^' anchor is not enough)
-- to... |
local MatchRewardListItem = class(Node);
MatchRewardListItem.ctor = function(self, data)
local match_reward_list_item = require(ViewPath .. "games/common2/match/match_reward_list_item");
local view = SceneLoader.load(match_reward_list_item);
local w, h = view:getSize();
self:addChild(view);
v... |
local local0 = 0.2
local local1 = 0 - local0
local local2 = 0 - local0
local local3 = 2.9 - local0
local local4 = 0 - local0
local local5 = 3.7 - local0
local local6 = 0 - local0
local local7 = 0 - local0
local local8 = 0 - local0
local local9 = 1.4 - local0
function OnIf_301030(arg0, arg1, arg2)
if arg2 == 0 then
... |
-- thread2.lua
-- Implements the second thread for debugging
return function()
print("This is thread 2, about to sleep.")
sleep(500)
print("Thread 2 has finished sleeping, will now run.")
local EndTime = os.clock() + 3
while (os.clock() < EndTime) do
io.write("2")
end
print("thread 2 done.")
end
|
local function table_print (tt, indent, done)
done = done or {}
indent = indent or 0
if type(tt) == "table" then
local sb = {}
for key, value in pairs (tt) do
table.insert(sb, string.rep (" ", indent)) -- indent it
if type (value) == "table" and not done [value] then
do... |
local calc_util = require("scripts.calc.util")
return function(rates, entity, emissions_per_second, prototypes, research_data)
if research_data then
--[[
due to a bug with entity_speed_bonus, we must subtract the force's lab speed bonus and convert it to a
multiplicative relationship
]]
local... |
local screen_ind = ui.add_multi_combo_box("Screen indicators", "screen_ind", { "Keybinds", "Watermark" }, { false, false })
local watermarkname = ui.add_text_input("Custom watermark name", "watermarkname", "gamesense.pub")
local watermarkusername = ui.add_text_input("Custom watermark username", "watermarkusername", "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.