repo_name stringlengths 6 69 | path stringlengths 6 178 | copies stringclasses 278
values | size stringlengths 4 7 | content stringlengths 671 917k | license stringclasses 15
values |
|---|---|---|---|---|---|
AlexeySa/rspamd | src/plugins/lua/url_tags.lua | 1 | 10274 | --[[
Copyright (c) 2016-2017, Vsevolod Stakhov <vsevolod@highsecure.ru>
Copyright (c) 2017, Andrew Lewis <nerf@judo.za.org>
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... | bsd-2-clause |
hawkchch/redis | deps/lua/test/sort.lua | 889 | 1494 | -- two implementations of a sort function
-- this is an example only. Lua has now a built-in function "sort"
-- extracted from Programming Pearls, page 110
function qsort(x,l,u,f)
if l<u then
local m=math.random(u-(l-1))+l-1 -- choose a random pivot in range l..u
x[l],x[m]=x[m],x[l] -- swap pivot to first posit... | bsd-3-clause |
atreeyang/redis | deps/lua/test/sort.lua | 889 | 1494 | -- two implementations of a sort function
-- this is an example only. Lua has now a built-in function "sort"
-- extracted from Programming Pearls, page 110
function qsort(x,l,u,f)
if l<u then
local m=math.random(u-(l-1))+l-1 -- choose a random pivot in range l..u
x[l],x[m]=x[m],x[l] -- swap pivot to first posit... | bsd-3-clause |
Wohlhabend-Networks/LunaDLL | LuaScriptsLibExt/autoscroll.lua | 2 | 5851 | --autoscroll.lua
--v1.0.2
--Created by Rednaxela, 2015
if (not API.isLoadingShared()) then
Misc.warning("autoscroll API should be loaded shared")
end
local autoscroll = {}
local active_scrolls = {}
local GM_CAMERA_X = mem(0x00B2B984, FIELD_DWORD)
local GM_CAMERA_Y = mem(0x00B2B9A0, FIELD_DWORD)
local GM_ORIG_LVL_BOU... | gpl-3.0 |
atatsu/giblets | widgets/progressbar.lua | 1 | 16689 | --- Progressbar widget.
-- This progressbar is very similar to the one you get with `awful.widget.progressbar`,
-- except that it is always drawn with segments, or ticks. In addition, rather than being
-- drawn with a solid border and ticks inside the border, each tick is drawn as
-- though it is its own entity. So if... | bsd-3-clause |
telthien/burning-wheel | lua-classgenerator/fileparser.lua | 1 | 1580 | require("stringtools");
fileparser = {debug = false}
function fileparser.get_classes(lineText)
local inClass = false;
classTable = {};
workingTable = {};
for lineID, line in pairs(lineText) do
workingTable[#workingTable + 1] = line;
if stringtools.starts(line,"C") then
assert(inClass == false, "C before E... | gpl-2.0 |
xyzz/minetest-stress | tests/run.lua | 1 | 1067 | --[[
To be able to run tests and see coverage:
download luacov from https://github.com/norman/luacov
download lunatest from https://github.com/silentbicycle/lunatest
place them into your minetest directory
Copy luacov from luacov/src/bin/luacov to minetest/luacov_s
Your directory structure should look like
luacov
├── ... | mit |
amirkingred/bestfunbot | plugins/plugins.lua | 35 | 5971 | --------------------------------------------------
-- ____ ____ _____ --
-- | \| _ )_ _|___ ____ __ __ --
-- | |_ ) _ \ | |/ ·__| _ \_| \/ | --
-- |____/|____/ |_|\____/\_____|_/\/\_| --
-- --
--------------... | gpl-2.0 |
AlexeySa/rspamd | contrib/torch/torch7/test/test_half.lua | 7 | 1841 | local mytester
local torchtest = torch.TestSuite()
-- Lua 5.2 compatibility
local loadstring = loadstring or load
local unpack = unpack or table.unpack
function torchtest.easy()
local x=torch.randn(5, 6):half()
mytester:assert(x:isContiguous(), 'x should be contiguous')
mytester:assert(x:dim() == 2, 'x shoul... | bsd-2-clause |
halilkaya/minetest-mods | animals/mobf/inventory.lua | 1 | 20446 | -------------------------------------------------------------------------------
-- Mob Framework Mod by Sapier
--
-- You may copy, use, modify or do nearly anything except removing this
-- copyright notice.
-- And of course you are NOT allow to pretend you have written it.
--
--! @file inventory.lua
--! @brief componen... | gpl-3.0 |
lumidify/Lord-of-the-Test | mods/lottfarming/blue.lua | 3 | 6053 | minetest.register_craftitem("lottfarming:blue_mushroom_spore", {
description = "Blue Mushroom Spores",
inventory_image = "lottfarming_blue_mushroom_spore.png",
on_place = function(itemstack, placer, pointed_thing)
return place_spore(itemstack, placer, pointed_thing, "lottfarming:blue_mushroom_1", 9)
end,
})... | lgpl-2.1 |
telebot2/telebot | plugins/wiki.lua | 2 | 4374 | -- http://git.io/vUA4M
local socket = require "socket"
local JSON = require "cjson"
local wikiusage = {
"!wiki [text]: Read extract from default Wikipedia (EN)",
"!wiki(lang) [text]: Read extract from 'lang' Wikipedia. Example: !wikies hola",
"!wiki search [text]: Search articles on default Wikipedia (EN)",
"!... | gpl-2.0 |
ashdnazg/Zero-K | ModelMaterials/4_features_trees.lua | 4 | 5133 | -- $Id$
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local windLocIDs = {[0] = -2, [1] = -2}
local function DrawFeature(featureID, material, drawMode) -- UNUSED!
local etcLocIdx = (drawMode == 5) and ... | gpl-2.0 |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/SplitRows.lua | 8 | 1888 |
--------------------------------
-- @module SplitRows
-- @extend TiledGrid3DAction
-- @parent_module cc
--------------------------------
-- brief Initializes the action with the number rows and the duration.<br>
-- param duration Specify the duration of the SplitRows action. It's a value in seconds.<br>
-- param rows... | mit |
rwygand/ngx_borderpatrol | src/authorize.lua | 1 | 4426 | local json = require("json")
local sessionid = require("sessionid")
-------------------------------------------
-- Make the call to the Account Service
-------------------------------------------
local session_id = ngx.var.cookie_border_session
-- require session because the only valid scenario for arriving here is... | mit |
ashdnazg/Zero-K | LuaUI/Widgets/api_gadget_icons.lua | 4 | 8416 | -------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
function widget:GetInfo()
return {
name = "Gadget Icons",
desc = "Shows icons from gadgets that cannot access the widget stuff ... | gpl-2.0 |
kinotrip/HelloRuby | frameworks/cocos2d-x/cocos/scripting/lua-bindings/script/cocostudio/CocoStudio.lua | 39 | 9065 |
if not json then
require "cocos.cocos2d.json"
end
ccs = ccs or {}
require "cocos.cocostudio.StudioConstants"
function ccs.sendTriggerEvent(event)
local triggerObjArr = ccs.TriggerMng.getInstance():get(event)
if nil == triggerObjArr then
return
end
for i = 1, table.getn(triggerObjArr) d... | gpl-2.0 |
AlexeySa/rspamd | src/plugins/lua/rbl.lua | 1 | 17277 | --[[
Copyright (c) 2011-2015, Vsevolod Stakhov <vsevolod@highsecure.ru>
Copyright (c) 2013-2015, Andrew Lewis <nerf@judo.za.org>
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.apach... | bsd-2-clause |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/CameraBackgroundDepthBrush.lua | 9 | 1759 |
--------------------------------
-- @module CameraBackgroundDepthBrush
-- @extend CameraBackgroundBrush
-- @parent_module cc
--------------------------------
-- Set depth<br>
-- param depth Depth used to clear depth buffer
-- @function [parent=#CameraBackgroundDepthBrush] setDepth
-- @param self
-- @param #float dep... | mit |
ashdnazg/Zero-K | scripts/amphaa.lua | 5 | 11953 | --linear constant 65536
include "constants.lua"
local scriptReload = include("scriptReload.lua")
local base, pelvis, torso, vent = piece('base', 'pelvis', 'torso', 'vent')
local rthigh, rcalf, rfoot, lthigh, lcalf, lfoot = piece('rthigh', 'rcalf', 'rfoot', 'lthigh', 'lcalf', 'lfoot')
local lgun, lbarrel1, lbarrel2, ... | gpl-2.0 |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/Physics3DRigidBody.lua | 11 | 12856 |
--------------------------------
-- @module Physics3DRigidBody
-- @extend Physics3DObject
-- @parent_module cc
--------------------------------
-- Set the acceleration.
-- @function [parent=#Physics3DRigidBody] setGravity
-- @param self
-- @param #vec3_table acceleration
-- @return Physics3DRigidBody#Physics3DRigi... | mit |
lumidify/Lord-of-the-Test | mods/lottachievements/api_helpers.lua | 3 | 2447 | function lottachievements.tbv(tb,value,default)
if not default then
default = {}
end
if not tb or type(tb) ~= "table" then
if not value then
value = "[NULL]"
end
minetest.log("error", "lottachievements.tbv - table "..dump(value).." is null, or not a table! Dump: "..dump(tb))
return
end
if not value th... | lgpl-2.1 |
ashdnazg/Zero-K | effects/fires.lua | 17 | 9989 | -- flamer
-- fire1_burn1_flame1
-- fire1_smoke1
-- fire1_burnlight
-- fire1_burn1_flame3
-- fire1_burn1_flame4
-- fire1_burn1
-- fire1_burn1_flame2
-- fire1
return {
["flamer"] = {
fire = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
... | gpl-2.0 |
aaiijmrtt/nn | MM.lua | 46 | 2695 | --[[ Module to perform matrix multiplication on two minibatch inputs,
producing a minibatch.
]]
local MM, parent = torch.class('nn.MM', 'nn.Module')
--[[ The constructor takes two optional arguments, specifying whether or not transpose
any of the input matrices before perfoming the multiplication.
]]
functi... | bsd-3-clause |
caldweln/nn | MM.lua | 46 | 2695 | --[[ Module to perform matrix multiplication on two minibatch inputs,
producing a minibatch.
]]
local MM, parent = torch.class('nn.MM', 'nn.Module')
--[[ The constructor takes two optional arguments, specifying whether or not transpose
any of the input matrices before perfoming the multiplication.
]]
functi... | bsd-3-clause |
lynnard/cocos2d-hs | cbits/cocos/scripting/lua-bindings/auto/api/EaseElasticOut.lua | 9 | 1215 |
--------------------------------
-- @module EaseElasticOut
-- @extend EaseElastic
-- @parent_module cc
--------------------------------
-- @overload self, cc.ActionInterval
-- @overload self, cc.ActionInterval, float
-- @function [parent=#EaseElasticOut] create
-- @param self
-- @param #cc.ActionInt... | bsd-3-clause |
AlexeySa/rspamd | contrib/torch/nn/SpatialAveragePooling.lua | 20 | 2357 | local SpatialAveragePooling, parent = torch.class('nn.SpatialAveragePooling', 'nn.Module')
function SpatialAveragePooling:__init(kW, kH, dW, dH, padW, padH)
parent.__init(self)
self.kW = kW
self.kH = kH
self.dW = dW or 1
self.dH = dH or 1
self.padW = padW or 0
self.padH = padH or 0
self.ceil_m... | bsd-2-clause |
male-puppies/openwrt-packages-puppies | net/prosody/files/prosody.cfg.lua | 147 | 7257 | -- Prosody Example Configuration File
--
-- Information on configuring Prosody can be found on our
-- website at http://prosody.im/doc/configure
--
-- Tip: You can check that the syntax of this file is correct
-- when you have finished by running: luac -p prosody.cfg.lua
-- If there are any errors, it will let you know... | gpl-2.0 |
NBSW/Atlas | examples/tutorial-basic.lua | 37 | 1739 | --[[ $%BEGINLICENSE%$
Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
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; version 2 of the
License.
This program is dis... | gpl-2.0 |
halilkaya/minetest-mods | homedecor/computer/init.lua | 11 | 3077 | computer = {}
screwdriver = screwdriver or {}
computer.register = function (name, def)
local nodename = name
if (name:sub(1, 1) == ":") then name = name:sub(2) end
local modname, basename = name:match("^([^:]+):(.*)")
local TEXPFX = modname.."_"..basename.."_"
local ONSTATE = modname..":"..basename
local OFFSTAT... | gpl-3.0 |
jbrashear/Vanilla-In-Game-Leveling-Guide | Core.lua | 1 | 5578 | --[[--------------------------------------------------
----- VanillaGuide -----
------------------
Core.lua
Authors: Liinx
Version: 1.00
------------------------------------------------------
Description:
Powerleveling Guide for 1.12.1 servers
based on Joana Guide
1.00
-- Initial Ace2 releas... | gpl-3.0 |
stevedonovan/AndroLua | assets/android/init.lua | 1 | 28706 | -----------------
-- AndroLua Activity Framework
-- @module android
require 'android.import'
-- public for now...
android = {}
local android = android
local LS = service -- which is global for now
local LPK = luajava.package
local L = LPK 'java.lang'
local C = LPK 'android.content'
local W = LPK 'android.widget'
loca... | mit |
ashdnazg/Zero-K | units/gunshipraid.lua | 2 | 3891 | unitDef = {
unitname = [[gunshipraid]],
name = [[Locust]],
description = [[Raider Gunship]],
acceleration = 0.18,
brakeRate = 0.16,
buildCostMetal = 220,
builder = false,
buildPic = [[gunshipraid.png]]... | gpl-2.0 |
gsick/luvit-logger | lib/file.lua | 1 | 1611 | local Object = require('core').Object
local String = require('string')
local Fs = require('fs')
local Path = require('path')
local Levels = require('./utils').Levels
local Utils = require('./utils')
local function _noop(err)
if err then
error('Logger error: ' .. err.message)
end
end
local FileLogger = ... | mit |
chiyun1/wax | tools/Tests/scripts/tests/classTest.lua | 17 | 4917 | require "tests.fixtures.ExtendedSimpleObject"
require "tests.fixtures.Deer"
require "tests.fixtures.Bambi"
describe["A WaxClass instance with an ObjC Super"] = function()
before = function()
end
it["is created via method"] = function()
local o = ExtendedSimpleObject:initWithAnimal("elephant")
expect(o... | mit |
vhpham80/luci | applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/mactodevinfo.lua | 80 | 1260 | --[[
LuCI - Lua Configuration Interface
(c) 2009 Daniel Dickinson
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
$Id$
]]--
m = Map("mactodevinfo", lu... | apache-2.0 |
halilkaya/minetest-mods | throwing/teleport_arrow.lua | 4 | 2778 | minetest.register_craftitem("throwing:arrow_teleport", {
description = "Teleport Arrow",
inventory_image = "throwing_arrow_teleport.png",
})
minetest.register_node("throwing:arrow_teleport_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.... | gpl-3.0 |
WolfGaming/OpenRA | lua/sandbox.lua | 84 | 5098 | local sandbox = {
_VERSION = "sandbox 0.5",
_DESCRIPTION = "A pure-lua solution for running untrusted Lua code.",
_URL = "https://github.com/kikito/sandbox.lua",
_LICENSE = [[
MIT LICENSE
Copyright (c) 2013 Enrique García Cota
Permission is hereby granted, free of charge, to an... | gpl-3.0 |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/PhysicsWorld.lua | 3 | 8548 |
--------------------------------
-- @module PhysicsWorld
-- @parent_module cc
--------------------------------
-- set the gravity value of this physics world.<br>
-- param gravity A gravity value of this physics world.
-- @function [parent=#PhysicsWorld] setGravity
-- @param self
-- @param #vec2_table gravity
-- @re... | mit |
atlimit8/OpenRA | mods/ra/maps/monster-tank-madness/monster-tank-madness.lua | 7 | 14908 | --[[
Copyright 2007-2022 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later vers... | gpl-3.0 |
zarbatehsan/programmer | plugins/all.lua | 1321 | 4661 | do
data = load_data(_config.moderation.data)
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print... | gpl-2.0 |
cedricporter/everlost | frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/ProtectedNode.lua | 2 | 2390 |
--------------------------------
-- @module ProtectedNode
-- @extend Node
--------------------------------
-- overload function: addProtectedChild(cc.Node, int)
--
-- overload function: addProtectedChild(cc.Node)
--
-- overload function: addProtectedChild(cc.Node, int, int)
--
-- @functi... | apache-2.0 |
cedricporter/everlost | src/framework/StateMachine.lua | 2 | 9125 |
local Component = import(".Component")
local StateMachine = class("StateMachine", Component)
--[[--
port from Javascript State Machine Library
https://github.com/jakesgordon/javascript-state-machine
JS Version: 2.2.0
]]
StateMachine.VERSION = "2.2.0"
-- the event transitioned successfully from one state to anot... | apache-2.0 |
lynnard/cocos2d-hs | cbits/cocos/scripting/lua-bindings/auto/api/FadeIn.lua | 11 | 1229 |
--------------------------------
-- @module FadeIn
-- @extend FadeTo
-- @parent_module cc
--------------------------------
-- js NA
-- @function [parent=#FadeIn] setReverseAction
-- @param self
-- @param #cc.FadeTo ac
-- @return FadeIn#FadeIn self (return value: cc.FadeIn)
--------------------------------
-... | bsd-3-clause |
AlexeySa/rspamd | contrib/torch/nn/VolumetricFullConvolution.lua | 6 | 7478 | local THNN = require 'nn.THNN'
local VolumetricFullConvolution, parent = torch.class('nn.VolumetricFullConvolution','nn.Module')
function VolumetricFullConvolution:__init(nInputPlane, nOutputPlane,
kT, kW, kH, -- kernel size
dT... | bsd-2-clause |
napcode/ardour | share/scripts/export_mp4chaps.lua | 5 | 2152 | ardour {
["type"] = "EditorAction",
name = "Export markers as mp4chaps",
author = "Johannes Mueller",
description = [[
Exports MP4chaps of all markers except xruns. The markers are stored in the
export directory of the session in mp4 chapter marks format. The filename
is mp4chaps.txt
Note that there's always a cha... | gpl-2.0 |
KratosTeam/terminator | plugins/helpen.lua | 1 | 2321 | --[[
|-------------------------------------------------------------------------------------------------|
| ######## ######## ######## ## ## #### ## ## ### ######## ####### ######## |
| ## ## ## ## ### ### ## ### ## ## ## ## ## ## ## ## |
| ## ##... | agpl-3.0 |
RazielSun/juma-editor | editor/lib/lua/old-editor/console.lua | 2 | 2281 | --------------------------------------------------------------------------------
--
--
--
--------------------------------------------------------------------------------
--============================================================================--
-- Console
--======================================================... | mit |
halilkaya/minetest-mods | travelnet/doors.lua | 5 | 4673 | -- Doors that are especially useful for travelnet elevators but can also be used in other situations.
-- All doors (not only these here) in front of a travelnet or elevator are opened automaticly when a player arrives
-- and are closed when a player departs from the travelnet or elevator.
-- Autor: Sokomine
minetest.r... | gpl-3.0 |
Doodle3D/doodle3d-firmware | src/rest/api/api_system.lua | 2 | 1456 | --
-- This file is part of the Doodle3D project (http://doodle3d.com).
--
-- @copyright 2013, Doodle3D
-- @license This software is licensed under the terms of the GNU GPL v2 or later.
-- See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
local utils = require('util.utils')
... | gpl-2.0 |
halilkaya/minetest-mods | streets/asphaltstairs/init.lua | 1 | 7999 | --[[
StreetsMod: Asphalt stairs
]]
if type(register_stair_slab_panel_micro) ~= "function" then return end
-- Asphalt
register_stair_slab_panel_micro("streets", "asphalt", "streets:asphalt", {cracky=3}, {"streets_asphalt.png"}, "Asphalt", "asphalt", nil)
minetest.register_alias("streets:asphalt_stair","stairs:stair_... | gpl-3.0 |
GiuseppeGorgoglione/mame | 3rdparty/genie/src/actions/fastbuild/fastbuild_solution.lua | 41 | 5961 | -- Generates a FASTBuild config file for a solution.
-- Note that table order iteration should be deterministic, so the .bff file content is not
-- arbitrarily changed each time it's generated. There are several places in this file
-- where sorts are done for that reason.
function premake.fastbuild.solution(sln)
-... | gpl-2.0 |
aaiijmrtt/nn | NarrowTable.lua | 38 | 1151 | local NarrowTable, parent = torch.class('nn.NarrowTable', 'nn.Module')
function NarrowTable:__init(offset, length)
parent.__init(self)
self.offset = offset
self.length = length or 1
if not offset then
error('nn.NarrowTable(offset, length)')
end
self.output = {}
self.gradInput = {}
end
f... | bsd-3-clause |
GiuseppeGorgoglione/mame | 3rdparty/genie/tests/baking/test_merging.lua | 57 | 2096 | --
-- tests/baking/test_merging.lua
-- Verifies different field types are merged properly during baking.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
T.baking_merging = { }
local suite = T.baking_merging
--
-- Setup code
--
local sln, prj, cfg
function suite.setup()
sln = solution "MySolution... | gpl-2.0 |
WolfGaming/OpenRA | mods/d2k/maps/harkonnen-06a/harkonnen06a.lua | 4 | 10560 | --[[
Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later vers... | gpl-3.0 |
GiuseppeGorgoglione/mame | scripts/extlib.lua | 4 | 2233 | -- license:BSD-3-Clause
-- copyright-holders:MAMEdev Team,Jeffrey Clark
local extlibs = {
--
-- 3rdparty system 3rdparty
-- lib name: lib name, include dir
--
expat = { "expat", "3rdparty/expat/lib" },
zlib = { "z", "3rdparty/zlib" },
jpeg = { "jpeg", ... | gpl-2.0 |
ashdnazg/Zero-K | LuaRules/Configs/cloak_shield_defs.lua | 16 | 1373 | -- Cloak Levels
--
-- 0: disabled
-- 1: conditionally enabled, uses energy
-- 2: conditionally enabled, does no use energy
-- 3: enabled, unless stunned
-- 4: always enabled
local uncloakables = {}
for k, v in pairs(UnitDefNames) do
if (v.customParams.cannotcloak) then
uncloakables[k] = true
end
end
l... | gpl-2.0 |
Akagi201/learning-lua | operator.lua | 1 | 1392 | -- 算术运算符
print(1 + 2) --> 3
print(5 / 10) --> 0.5, 与C不同
print(5.0 / 10) --> 0.5
--print(10 / 0)
print(2 ^ 10) --> 1024
local num = 1357
print(num % 2) --> 1
print((num % 2) == 1) --> true
print((num % 5) == 0) --> false
-- 关系运算符
print(1 < 2) --> true
print(1 == 2) --> false
print(1 ~= 2) --> true, 与C不同
local a, b =... | gpl-2.0 |
mohammad8/hu | plugins/admin.lua | 230 | 6382 | local function set_bot_photo(msg, success, result)
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/bot.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
set_profile_photo(file, ok_cb, false)
send_large_msg(rec... | gpl-2.0 |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/ProgressTo.lua | 8 | 2076 |
--------------------------------
-- @module ProgressTo
-- @extend ActionInterval
-- @parent_module cc
--------------------------------
-- brief Initializes with a duration and destination percentage. <br>
-- param duration Specify the duration of the ProgressTo action. It's a value in seconds.<br>
-- param percent Sp... | mit |
WolfGaming/OpenRA | mods/ra/maps/fort-lonestar/fort-lonestar.lua | 4 | 7769 | --[[
Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later vers... | gpl-3.0 |
tahabaghshomalazar/CrystaL_bot | plugins/meme.lua | 637 | 5791 | local helpers = require "OAuth.helpers"
local _file_memes = './data/memes.lua'
local _cache = {}
local function post_petition(url, arguments)
local response_body = {}
local request_constructor = {
url = url,
method = "POST",
sink = ltn12.sink.table(response_body),
headers = {},
red... | gpl-2.0 |
ashdnazg/Zero-K | scripts/tankriot.lua | 2 | 4907 | include "constants.lua"
include "rockPiece.lua"
include "trackControl.lua"
include "pieceControl.lua"
local base, turret, sleeve = piece ('base', 'turret', 'sleeve')
local missiles = {
piece ('dummy1'),
piece ('dummy2'),
}
local SIG_AIM = 1
local SIG_MOVE = 2
local SIG_ROCK_X = 4
local SIG_ROCK_Z = 8
local ROCK_F... | gpl-2.0 |
vhpham80/luci | protocols/ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua | 59 | 3798 | --[[
LuCI - Lua Configuration Interface
Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
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
]]--
local ma... | apache-2.0 |
saeqe/telespark | plugins/search_youtube.lua | 674 | 1270 | do
local google_config = load_from_file('data/google.lua')
local function httpsRequest(url)
print(url)
local res,code = https.request(url)
if code ~= 200 then return nil end
return json:decode(res)
end
local function searchYoutubeVideos(text)
local url = 'https://www.googleapis.com/youtube/v3/search?'
u... | gpl-2.0 |
cedricporter/everlost | frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/ActionManager.lua | 6 | 2041 |
--------------------------------
-- @module ActionManager
-- @extend Ref
--------------------------------
-- @function [parent=#ActionManager] getActionByTag
-- @param self
-- @param #int int
-- @param #cc.Node node
-- @return Action#Action ret (return value: cc.Action)
--------------------------------
-- @... | apache-2.0 |
halilkaya/minetest-mods | homedecor/homedecor/handlers/sit.lua | 13 | 1049 | function homedecor.sit(pos, node, clicker)
do return end -- delete it when the engine is stabler for the player's physics
local meta = minetest.get_meta(pos)
local param2 = node.param2
local name = clicker:get_player_name()
if name == meta:get_string("is_sit") then
meta:set_string("is_sit", "")
pos.y = pos.y-... | gpl-3.0 |
halilkaya/minetest-mods | plantlife/dryplants/crafting.lua | 3 | 10500 | -----------------------------------------------------------------------------------------------
-- Dry Plants - Recipes 0.1.0 -- Short Grass -> Dirt
-----------------------------------------------------------------------------------------------
-- by Mossmanikin
-- License (everything): WTFPL
-- Looked at code ... | gpl-3.0 |
mitterdoo/wire | lua/entities/gmod_wire_expression2/core/e2lib.lua | 8 | 22142 | AddCSLuaFile()
E2Lib = {}
local type = type
local function checkargtype(argn, value, argtype)
if type(value) ~= argtype then error(string.format("bad argument #%d to 'E2Lib.%s' (%s expected, got %s)", argn, debug.getinfo(2, "n").name, argtype, type(text)), 2) end
end
-- -------------------------- Helper functions -... | apache-2.0 |
facebokiii/UHproject | plugins/boobs.lua | 731 | 1601 | do
-- Recursive function
local function getRandomButts(attempt)
attempt = attempt or 0
attempt = attempt + 1
local res,status = http.request("http://api.obutts.ru/noise/1")
if status ~= 200 then return nil end
local data = json:decode(res)[1]
-- The OpenBoobs API sometimes returns an empty array
if no... | gpl-2.0 |
Abu0Ali/abu0alibot | plugins/map.lua | 1 | 1251 | --[[
MAB : طقس
--]]
do
local api_key = nil
local base_api = "https://maps.googleapis.com/maps/api"
function get_staticmap(area)
local api = base_api .. "/staticmap?"
-- Get a sense of scale
local lat,lng,acc,types = get_latlong(area)
local scale = types[1]
if scale=="locality" then zoom=8
... | gpl-2.0 |
ashdnazg/Zero-K | LuaUI/Widgets/chili/Controls/colorbars.lua | 25 | 2469 | --//=============================================================================
Colorbars = Control:Inherit{
classname = "colorbars",
color = {1,1,1,1},
defaultWidth = 100,
defaultHeight = 20,
OnChange = {},
}
local this = Colorbars
local inherited = this.inherited
--//=============================... | gpl-2.0 |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/Repeat.lua | 11 | 2502 |
--------------------------------
-- @module Repeat
-- @extend ActionInterval
-- @parent_module cc
--------------------------------
-- Sets the inner action.<br>
-- param action The inner action.
-- @function [parent=#Repeat] setInnerAction
-- @param self
-- @param #cc.FiniteTimeAction action
-- @return Repeat#Repea... | mit |
xcjmine/skynet | service/snaxd.lua | 29 | 2244 | local skynet = require "skynet"
local c = require "skynet.core"
local snax_interface = require "snax.interface"
local profile = require "skynet.profile"
local snax = require "skynet.snax"
local snax_name = tostring(...)
local loaderpath = skynet.getenv"snax_loader"
local loader = loaderpath and assert(dofile(loaderpat... | mit |
ashdnazg/Zero-K | ModelMaterials/0_customskins.lua | 4 | 2125 | -- $Id$
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local materials = {
altSkinS3o = {
shaderDefinitions = {
"#define deferred_mode 0",
},
deferredDefinitions = {
... | gpl-2.0 |
saeqe/telespark | plugins/get.lua | 613 | 1067 | local function get_variables_hash(msg)
if msg.to.type == 'chat' then
return 'chat:'..msg.to.id..':variables'
end
if msg.to.type == 'user' then
return 'user:'..msg.from.id..':variables'
end
end
local function list_variables(msg)
local hash = get_variables_hash(msg)
if hash then
local names =... | gpl-2.0 |
facebokiii/UHproject | plugins/get.lua | 613 | 1067 | local function get_variables_hash(msg)
if msg.to.type == 'chat' then
return 'chat:'..msg.to.id..':variables'
end
if msg.to.type == 'user' then
return 'user:'..msg.from.id..':variables'
end
end
local function list_variables(msg)
local hash = get_variables_hash(msg)
if hash then
local names =... | gpl-2.0 |
geoffleyland/lua-kdtree | lua/test/text_random_boxes.lua | 1 | 1077 | local kdtree = require"kdtree"
local function random_box(dims)
local min, max = {}, {}
for i = 1, dims do
local centre, span = math.random(10000), math.random(5000)
min[i], max[i] = centre - span, centre + span
end
return { min = min, max = max }
end
local function box_bounds(b)
return b.min, b.max... | mit |
ashdnazg/Zero-K | scripts/nebula.lua | 5 | 3901 | include "constants.lua"
--include 'letsNotFailAtTrig.lua'
--------------------------------------------------------------------------------
--pieces
local hull, facframe = piece ("hull", "facframe")
local base = piece("base")
local engines = {}
local pads = {}
local docked = {}
-- 1, 2, 3, 4 = rear top, rear bottom, le... | gpl-2.0 |
mutewinter/dot_vim | lua/lush_theme/jellybeans.lua | 1 | 1738 | local lush = require('lush')
local hsl = lush.hsl
local jellybeans = require('lush_theme.jellybeans-nvim')
local nice_red = "#ff5656" -- A nicer red, also from https://git.io/Jfs2T
local mantis = "#70b950" -- From Jellybeans
local koromiko = "#ffb964" -- From Jellybeans
local wewak = "#f0a0c0"
local morning_glory = "... | mit |
halilkaya/minetest-mods | craftingpack/crafting/creative.lua | 1 | 12823 | crafting = {}
crafting.creative_inventory_size = 0
function init()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
... | gpl-3.0 |
WolfGaming/OpenRA | mods/ra/maps/survival01/survival01.lua | 4 | 14949 | --[[
Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later vers... | gpl-3.0 |
atlimit8/OpenRA | mods/cnc/maps/nod07b/nod07b-AI.lua | 2 | 5304 | --[[
Copyright 2007-2022 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later vers... | gpl-3.0 |
ali-iraqi-bot/devil3_bot | plugins/stats.lua | 79 | 4014 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_prin... | agpl-3.0 |
lynnard/cocos2d-hs | cbits/cocos/scripting/lua-bindings/auto/api/TextField.lua | 3 | 13123 |
--------------------------------
-- @module TextField
-- @extend Widget
-- @parent_module ccui
--------------------------------
-- brief Toggle attach with IME.<br>
-- param attach True if attach with IME, false otherwise.
-- @function [parent=#TextField] setAttachWithIME
-- @param self
-- @param #bool attach
-- @re... | bsd-3-clause |
andreaskoepf/matrixwalk | agent.lua | 1 | 1178 |
--[[
A simple agent that keeps track of it's position
and ensures that it stays inside the world boundaries.
]]--
local Agent = torch.class('Agent')
-- If initial_pos is omitted position set to a random value.
function Agent:__init(world, initial_pos)
self.world = world
self.d = world:dim()
self.size = world:si... | mit |
AlexeySa/rspamd | src/plugins/lua/dmarc.lua | 1 | 46727 | --[[
Copyright (c) 2011-2016, Vsevolod Stakhov <vsevolod@highsecure.ru>
Copyright (c) 2015-2016, Andrew Lewis <nerf@judo.za.org>
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.apach... | bsd-2-clause |
ashdnazg/Zero-K | gamedata/resources.lua | 5 | 6043 | -- $Id: resources.lua 4609 2009-05-12 01:32:58Z carrepairer $
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: resources.lua
-- brief: resources definitions
--
----------------------------... | gpl-2.0 |
jbrashear/Vanilla-In-Game-Leveling-Guide | libs/AceAddon-2.0/AceAddon-2.0.lua | 1 | 31502 | --[[
Name: AceAddon-2.0
Revision: $Rev: 16523 $
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
Website: http://www.wowace.com/
Documentation: http://www.wowace.com/index.php/AceAddon-2.0
SVN: http://svn.wowace.co... | gpl-3.0 |
kinotrip/HelloRuby | frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/ActionScaleFrame.lua | 10 | 1483 |
--------------------------------
-- @module ActionScaleFrame
-- @extend ActionFrame
-- @parent_module ccs
--------------------------------
-- Changes the scale action scaleY.<br>
-- param rotation the scale action scaleY.
-- @function [parent=#ActionScaleFrame] setScaleY
-- @param self
-- @param #float scaleY
... | gpl-2.0 |
superopen/openwrt-luci | applications/luci-asterisk/luasrc/model/cbi/asterisk/dialzones.lua | 91 | 3529 | --[[
LuCI - Lua Configuration Interface
Copyright 2008 Jo-Philipp Wich <xm@subsignal.org>
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
$Id: trunks.l... | apache-2.0 |
xunkutech/openwrt-extra | luci/applications/luci-shadowsocks/luasrc/model/cbi/shadowsocks.lua | 3 | 4044 | --[[
RA-MOD
]]--
local fs = require "nixio.fs"
local sslocal =(luci.sys.call("pidof ss-local > /dev/null") == 0)
local ssredir =(luci.sys.call("pidof ss-redir > /dev/null") == 0)
if sslocal or ssredir then
m = Map("shadowsocks", translate("shadowsocks"), translate("shadowsocks is running"))
else
m = Map("shadowsoc... | gpl-2.0 |
atlimit8/OpenRA | mods/ra/maps/intervention/intervention.lua | 7 | 10528 | --[[
Copyright 2007-2022 The OpenRA Developers (see AUTHORS)
This file is part of OpenRA, which is free software. It is made
available to you under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later vers... | gpl-3.0 |
minaka1412/Cocos3DEditor | cocos2d/cocos/scripting/lua-bindings/auto/api/ComAttribute.lua | 19 | 2639 |
--------------------------------
-- @module ComAttribute
-- @extend Component
-- @parent_module ccs
--------------------------------
--
-- @function [parent=#ComAttribute] getFloat
-- @param self
-- @param #string key
-- @param #float def
-- @return float#float ret (return value: float)
-------------------... | mit |
Tardan/myFactorioMods | prototypes/extended/lamp.lua | 1 | 4243 | data:extend({
{
type = "lamp",
name = "big-lamp2",
icon = "__TechTier5Extension__/graphics/icons/lamp-v2.png",
flags = { "placeable-neutral", "player-creation" },
minable = { hardness = 0.2, mining_time = 0.5, result = "big-lamp2" },
max_health = 55,
corpse = ... | mit |
GABEROON/jeuGit | classes/classe_interface.lua | 1 | 5579 | -----------------------------------------------------------------------------------------
-- MADE BY GABRIEL CLOUTIER
-- classe_interface.lua
--
-- !important display.newImageRect( [parent,] filename, [baseDir,] width, height ) pour les images
----------------------------------------------------------------------------... | mit |
smalldelta/mathevoks | texlive/texmf-dist/doc/luatex/base/fdata_epdf.lua | 3 | 73087 | -- $Id: fdata_epdf.lua 4559 2013-01-20 19:58:26Z hhenkel $
local fdata_epdf = {
functions = {
open = {
type = "function",
shortdesc = "Construct a PDFDoc object by opening a PDF document.",
arguments = {
{type = "string", name = "filename", optional = false, },
},
returnvalu... | mit |
AlexeySa/rspamd | test/lua/unit/url.lua | 3 | 5272 | -- URL parser tests
context("URL check functions", function()
local mpool = require("rspamd_mempool")
local url = require("rspamd_url")
local logger = require("rspamd_logger")
local ffi = require("ffi")
ffi.cdef[[
void rspamd_url_init (const char *tld_file);
unsigned ottery_rand_range(unsigned top);
vo... | bsd-2-clause |
ashdnazg/Zero-K | units/tankassault.lua | 5 | 3337 | unitDef = {
unitname = [[tankassault]],
name = [[Minotaur]],
description = [[Assault Tank]],
acceleration = 0.0237,
brakeRate = 0.04786,
buildCostMetal = 850,
builder = false,
buildPic = [[tankassault.png]],
canGuard ... | gpl-2.0 |
lynnard/cocos2d-hs | cbits/cocos/scripting/lua-bindings/auto/api/NavMeshAgent.lua | 8 | 7443 |
--------------------------------
-- @module NavMeshAgent
-- @extend Component
-- @parent_module cc
--------------------------------
-- set maximal speed of agent
-- @function [parent=#NavMeshAgent] setMaxSpeed
-- @param self
-- @param #float maxSpeed
-- @return NavMeshAgent#NavMeshAgent self (return value: cc.NavM... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.