摘要: 作为一种嵌入式语言,lua提供了一套完备的 C API来帮助 lua 与 宿主程序进行交互。因此使用 C 或者 C++ 来为lua编写模块是很容易的。 看一下lua (5.1) 中对 string 模块的封装源码 lstrlib.c 在 lstrlib.c 最后有这样的代码 类似的代码也出现再了 l 阅读全文
posted @ 2018-03-08 11:59 熊二 阅读(955) 评论(0) 推荐(0) 编辑
摘要: Channel 的死锁 1没有缓冲区的channel 代码1 func f(){ ch := make(chan int) ch 阅读全文
posted @ 2018-09-22 22:14 熊二 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 问题描述 前端 vue, 后端 django 。前端在发送post到后端时返回 403:CSRF Failed: CSRF token missing or incorrect 原因 django,会对合法的跨域访问做这样的检验,cookies里面存储的’csrftoken’,和post的heade 阅读全文
posted @ 2018-09-11 15:15 熊二 阅读(2125) 评论(0) 推荐(0) 编辑
摘要: 报错如下: npm ERR! code ELIFECYCLE npm ERR! webpack test@1.0.0 build: npm ERR! Exit status 126 rm rf node_modules rm package lock.json npm cache clear for 阅读全文
posted @ 2018-09-11 10:31 熊二 阅读(1915) 评论(0) 推荐(0) 编辑
摘要: 介绍 ETCD : 高可用的分布式key value存储,可以用于配置共享和服务发现。 类似项目:zookeeper和consul import ( "github.com/coreos/go etcd/etcd" "log" ) var ( client etcd.Client machines 阅读全文
posted @ 2018-09-10 18:09 熊二 阅读(2914) 评论(0) 推荐(0) 编辑
摘要: 问题描述 代码逻辑 这段代码是想,给生成的一个GameObject挂一个 Canvas ,并且设置它的层级 结果发现这段代码并没有达到预想的目的。 原因 新生成的 GameObject 默认是再世界节点下的,这时Canvas的 overrideSorting 属性时不容许修改的。因此 overrid 阅读全文
posted @ 2018-04-19 19:38 熊二 阅读(1670) 评论(1) 推荐(0) 编辑
摘要: lua_State 是什么东西 lua 5.1 在使用lua API 时第一步经常是上面这句话,那么 lua_State 到底是什么东西? 先看看下面对 luaL_newstate() 的实现 继续看 luaL_newstate 是怎么创建 lua_State 的 可见在调用 luaL_newsta 阅读全文
posted @ 2018-03-08 16:42 熊二 阅读(601) 评论(0) 推荐(0) 编辑
摘要: 在Unity开发中经常会遇到这样的问题,如果text的内容超过给定的宽度则截断并追加 “...”。 以下便是解决该问题的代码 当然这类方法也可以写成Text的扩展,方便调用 阅读全文
posted @ 2017-10-09 12:25 熊二 阅读(1466) 评论(0) 推荐(0) 编辑
摘要: Unity中将lua脚本挂载到GameObject 阅读全文
posted @ 2017-10-09 10:38 熊二 阅读(3478) 评论(1) 推荐(0) 编辑
摘要: 1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.UI; 5 6 [AddComponentMenu("UI/Effects/GradientText")] 7 public class GradientText : Ba... 阅读全文
posted @ 2017-09-30 18:36 熊二 阅读(973) 评论(0) 推荐(0) 编辑